Hello, i'm using a prog from CPC power to display Ascii files :
MODE 2:OPENIN "fichier.txt":WHILE NOT EOF:INPUT #9,a$:print a$:WEND:CLOSEIN
It works well, except when it must display commas (ascii 44), then it just do a CR...
Is there any way to modify this program to display also commas ?
Quote from: remax on 18:48, 28 July 16
Hello, i'm using a prog from CPC power to display Ascii files :
MODE 2:OPENIN "fichier.txt":WHILE NOT EOF:INPUT #9,a$:print a$:WEND:CLOSEIN
It works well, except when it must display commas (ascii 44), then it just do a CR...
Is there any way to modify this program to display also commas ?
I once needed the same, then I used a semicolon as comma, and defined new SYMBOL for semicolon....
Quote from: Devilmarkus on 18:58, 28 July 16
I once needed the same, then I used a semicolon as comma, and defined new SYMBOL for semicolon....
Yeah... dirty but efficient :D
I'll do that if nobody thinks of another solution.
Do you tried LINE INPUT? ;)
Quote from: Fessor on 19:42, 28 July 16
Do you tried LINE INPUT? ;)
That was the tidy way, thank you very much !
Sorry if this sounds like a silly question, when an European CPC finds ASCII 44, CR occurs instead of ASCII 13? I'm confused! ???
The problem is that INPUT uses the comma as a separator. You can use "INPUT a$,b$" to read two strings at once, for example.
This also work for reading from a file, so you can use it for a kind of structured data (CSV files).
LINE INPUT instead always reads a whole line, so it does not ahve this feature.