Displaying an ascii file

Started by remax, 20:48, 28 July 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

remax

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 ?

Devilmarkus

Quote from: remax on 20: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....
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

remax

Quote from: Devilmarkus on 20: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.

Fessor

Do you tried LINE INPUT? ;)



remax

Quote from: Fessor on 21:42, 28 July 16
Do you tried LINE INPUT? ;)


That was the tidy way, thank you very much !

AMSDOS

Sorry if this sounds like a silly question, when an European CPC finds ASCII 44, CR occurs instead of ASCII 13? I'm confused!  ???

* Using the old Amstrad Languages :D   * with the Firmware :P
* I also like to problem solve code in BASIC :)   * And type-in Type-Ins! :D

Home Computing Weekly Programs
Popular Computing Weekly Programs
Your Computer Programs
Updated Other Program Links on Profile Page (Update April 16/15 phew!)
Programs for Turbo Pascal 3

PulkoMandy

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.

Powered by SMFPacks Menu Editor Mod