graphics 800,600,0,2
outfile=writefile("test.dat")
if outfile=0 then runtimeerror("could not open file for writing")
writeint outfile,123456
writefloat outfile,123.456
writestring outfile,"abcdefg"
closefile outfile
infile=readfile("test.dat")
if infile=0 then runtimeerror("could not open file for reading")
;make sure it is read in in the same order it was written
myint=readint(infile)
myfloat#=readfloat(infile)
mystring$=readstring(infile)
text 0,0,myint
text 0,20,myfloat
text 0,40,mystring
flip
waitkey
end
|