GLBasic User Manual

Main sections

PUTFILE

PUTFILE file$, lin#, dat#$



Writes the value of the variable dat#$ to the file file$ and the line number lin#.The first line has the index 0. It is not possible to to use PUTFILE with files of more than 256 lines.

Using PUTFILE to insert into a line that already has data in it will overwrite the original data with the new data.
PUTFILE will insert blank lines into the file where necessary. For example, if your file contains 20 lines and you insert into line 25, lines 21-24 will automatically be created as blank lines.

Sample:
 
a$="NAME";
PUTFILE "Test.txt", 0, s$
a$=""
GETFILE "Test.txt", 0, a$
PRINT a$, 100, 100
SHOWSCREEN
MOUSEWAIT

See also...