This program runs pretty good, but when I open the project folder, there is no text file. So I put my own text file entitled "myfile.txt" in the media folder.
But when I open it up to read it, it is blank. So, maybe the text file is somewhere else? Or maybe I'm supposed to save it first, or (confused) .. where could I find the text file?
{ link- Agk projects/Files/Reading from files }
SetErrorMode(2)
// write data to a file
OpenToWrite ( 1, "myfile.txt", 1 )
WriteInteger ( 1, 10 )
WriteFloat ( 1, 1.23 )
WriteString ( 1, "hello" )
WriteLine (1, "Bubba the great is here again")
CloseFile ( 1 )
// reading from a file
OpenToRead ( 1, "myfile.txt" )
t$ = readline(1)
a = ReadInteger ( 1 )
b# = ReadFloat ( 1 )
c$ = ReadString ( 1 )
sleep(17)
setprintcolor(255,255,255)
do
print(t$)
print(a)
print(b#)
print(c$)
CloseFile ( 1 )
sync()
.