RosettaCodeData/Task/Read-entire-file/Commodore-BASIC/read-entire-file.basic
2023-07-01 13:44:08 -04:00

14 lines
489 B
Text

10 rem load the entire contents of some text file as a single string variable.
20 rem should avoid reading an entire file at once if the file is large
30 rem ================================
40 print chr$(14) : rem switch to upper+lowercase character set
50 open 4,8,4,"data.txt,seq,read"
60 n=0
70 for i=0 to 1
80 get#4,x$
90 i=st and 64 : rem check for 'end-of-file'
100 if i=0 then a$=a$+x$ : n=n+1
110 if n=255 then i=1 : rem max string length is 255 only
120 next
130 close 4
140 end