Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Commas, I just can't find the commas... 1

Status
Not open for further replies.

rtl4444

Programmer
Nov 8, 2005
5
US
Need help finding the difference between a txt. file line limited by a "ret"(lf,cr,etc) and one limited by a comma.
I put together a quick little pgr. to convert PC text files into C=128 numbered listings for a friend, and handled all effects except for comments containing commas.
I can't find any way, in QBasic to tell the difference... help...

Bob
 
Have you looked at
LINE INPUT
That supposed to read whole line till cr|LF, no respect to commas.

If this does not help please post text sample - what you want it to do, where it works and were it doesn't... I'm afraid I'm not quite sure what you mean otherwise.
 
Thanks, tsh73, I'll try that. Something I'm not familiar with.
I was using "INPUT #1, a$" to get the data.

Later,
Bob
 
It wasn't a line limited by the comma. A line is limited by the return.
In your program you were reading in a variable, which with no comma was limited by the return.
If the line lengths are all the same you could check length of the A$ and if it is less than line length you know that a comma was the terminator. Then read in another variable, combine the two into A$ and check the length again.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Ok, I have more time now to give a test sample.

" (= starting code)
CHARGET1 LDA #$0D ;value for a return, skip next 3
HEX 2C ;skip next two bytes
LDA #$20 ;enter here for value for space
STA CHARADD1 ;set for output
JSR CHAROUT ;for output of space,return,etc.
"
" (= my translation (so far))
2020 charget1 lda #$0d ;value for a return
2030 skip next 3
2040 .byt $2c ;skip next two bytes
2050 :lda #$20 ;enter here for value for space
2060 :sta charadd1 ;set for output
2070 :jsr charout ;for output of space
2080 return
2090 etc.
"
" (which should be this (if I could find the #%! commas))
2020 charget1 lda #$0d ;value for a return, skip next 3
2030 .byt $2c ;skip next two bytes
2040 :lda #$20 ;enter here for value for space
2050 :sta charadd1 ;set for output
2060 :jsr charout ;for output of space,return,etc.
"
(Else an assembler will consider skip, return, & etc. as labels (without hand editing))
(And since I've already added line numbers, changed cmds. to lower case, changed 'HEX' to '.byt' and added "$" to values, and indented non-labels, it'd only be complete to eliminate this last problem)

Thanks for the help,
Bob
 
Ed:
As the sample above demonstrates, length is highly variable. The text that the code comes from is as much as 50 pages of single spaced text where some lines have only a <9 char. label, and others have extended comments.
:Bob
 
In the sample text shown it will require the line input or as an alternative a single character input and build the line. Using the single character you could filter the commas or substitute for them.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Thank you very much, tsh73,

Your suggestion of 'LINE INPUT' was the "Answer!", as I imediately realized when I finally got around to reading about it from the 'HELP' screen. Had never used that command before, obviously.
It not only gave me the input that I wanted but reduced my program length by a third, after I removed all the, now, excess tests for handling the missing commas and the broken lines of input.

Thanks again,
Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top