Author Topic: Displaying an ascii file  (Read 1591 times)

0 Members and 1 Guest are viewing this topic.

Offline remax

  • 6128 Plus
  • ******
  • Posts: 1.137
  • Country: fr
    • Awards
Displaying an ascii file
« on: 20:48, 28 July 16 »
Hello, i'm using a prog from CPC power to display Ascii files :

Code: [Select]
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 ?
like
0
No reactions

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.035
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
    • Awards
Re: Displaying an ascii file
« Reply #1 on: 20:58, 28 July 16 »
Hello, i'm using a prog from CPC power to display Ascii files :

Code: [Select]
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....
like
0
No reactions
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

Offline remax

  • 6128 Plus
  • ******
  • Posts: 1.137
  • Country: fr
    • Awards
Re: Displaying an ascii file
« Reply #2 on: 21:01, 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.
like
0
No reactions

Offline Fessor

  • CPC6128
  • ****
  • Posts: 262
  • Country: de
    • Awards
Re: Displaying an ascii file
« Reply #3 on: 21:42, 28 July 16 »
Do you tried LINE INPUT? ;)


like
0
No reactions

Offline remax

  • 6128 Plus
  • ******
  • Posts: 1.137
  • Country: fr
    • Awards
Re: Displaying an ascii file
« Reply #4 on: 22:37, 28 July 16 »
Do you tried LINE INPUT? ;)


That was the tidy way, thank you very much !
like
0
No reactions

Offline AMSDOS

  • Supporter
  • 6128 Plus
  • *
  • Posts: 3.939
  • Country: au
    • index.php?action=treasury
    • Programs for Turbo Pascal 3
    • Awards
Re: Displaying an ascii file
« Reply #5 on: 11:11, 29 July 16 »
Sorry if this sounds like a silly question, when an European CPC finds ASCII 44, CR occurs instead of ASCII 13? I'm confused!  ???
like
0
No reactions
* 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

Offline PulkoMandy

  • 464 Plus
  • *****
  • Posts: 455
  • Country: fr
    • Awards
Re: Displaying an ascii file
« Reply #6 on: 11:48, 29 July 16 »
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.
like
0
No reactions