Writes display-formatted data to a sequential file.
Print #n[, y, a$,...]
x, y:aexp
a$:sexp
Print # outputs data to a previously opened channel. n is a channel number in the range from 0 to 511. Other than that, Print # is equivalent to Print.
OpenW 1
Local a$, x%, ch%, i%
a$ = "Writing a file"
Text 0, 20, a$
Open "C:\TEST.DAT" for Output As # 1
Print # 1, "Hallo GFA"
Print # 1, "GFA-"
Print # 1, "BASIC 32"
Close # 1
Text 0, 40, "Press any key"
KeyGet x%
a$ = "Reading a file"
WindGet 14, ch%
Text 0, 60, a$
Open "C:\TEST.DAT" for Input As # 1
For i% = 1 To 3
Input # 1, a$
Text 0, 60 + i% * ch%, a$
Next i%
Close # 1
// Tidy-up line
Kill "c:\TEST.DAT"
Opens the file TEST.DAT on drive C and writes the strings Hello GFA, GFA-, and BASIC to it. The file then read back in again.
Input # reads a line until the next comma. German numbers are often printed using a comma to separate the fractional part. To prevent problems, write numbers using Write#, or change the number format with Mode Using.
{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}