CPCWiki forum

General Category => General Discussion - Introductions => Topic started by: Audronic on 01:23, 27 June 15

Title: Noob Help - How to display a text file on the screen (Basic)
Post by: Audronic on 01:23, 27 June 15
Hi All


After reading the manual for 45 minutes I am here.
i wish to read a File "  -readme.txt " on a DSK in an emulator. I am in basic.


I have exhausted all that i know.


What is the syntax to read the file to the screen???


Thanks    Ray


Title: Re: Noob Help - How to display a text file on the screen (Basic)
Post by: mahlemiut on 01:45, 27 June 15
Try the following program:
10 OPENIN "-readme.txt"
20 WHILE NOT EOF
30 INPUT #9,a$
40 print a$
50 WEND
60 CLOSEIN

(based on the example program for EOF in the 6128 manual)

Other options include the TYPE command in CP/M, FutureOS and X-DDOS (and maybe others too) have similar functions.
Title: Re: Noob Help - How to display a text file on the screen (Basic)
Post by: ronaldo on 01:51, 27 June 15
As @mahlemiut (http://www.cpcwiki.eu/forum/index.php?action=profile;u=89) says, there is no single BASIC command to read and type to screen the contents of an ASCII text file. They way to do it in BASIC is creating a simple program that opens the file, reads it and prints to screen. Extending what @mahlemiut (http://www.cpcwiki.eu/forum/index.php?action=profile;u=89) posted:

10 OPENIN "-readme.txt"
20 a$="-"
30 WHILE a$<>""
40  INPUT #9,a$
50  PRINT a$
60 WEND

That will open the file, read and print lines until no more lines are available :).
Title: Re: Noob Help - How to display a text file on the screen (Basic)
Post by: Audronic on 01:54, 27 June 15
@ mahlemuit  and ronaldo


Thanks for the info.
I will use CPM to type the file.

Thanks chaps       Ray
Title: Re: Noob Help - How to display a text file on the screen (Basic)
Post by: ZbyniuR on 06:06, 27 June 15
@Audronic (http://www.cpcwiki.eu/forum/index.php?action=profile;u=1169) - There is on ZIP/DSK file my program  '0.bas'
Just for Fun: C64 roms v2 (http://www.cpcwiki.eu/forum/off-topic/just-for-fun-c64-roms-v2/msg95130/#msg95130)
It's easy starter that shows TXT files. Maybe you'll like it. :)
Powered by SMFPacks Menu Editor Mod