The only way you can tell which position to read from is by using SKIP BYTES.
Reading a number is easy;
if you wrote the number to the file using the
WRITE FLOAT/WORD/LONG commands then you just use the READ FLOAT/WORD/LONG command to read it back in.
if file exist("test.txt") then delete file "test.txt"
open to write 1,"test.txt"
write long 1,123
write float 1,123.456
close file 1
open to read 1,"test.txt"
read long 1,i
read float 1,f#
close file 1
print i
print f#
wait key
If you want the text file to be human readable you need to READ/WRITE STRING and convert the string to a number using VAL()
if file exist("test.txt") then delete file "test.txt"
open to write 1,"test.txt"
write string 1,str$(123)
write string 1,str$(123.456)
close file 1
open to read 1,"test.txt"
read string 1,s$
i = val(s$)
read string 1,s$
f# = val(s$)
close file 1
print i
print f#
wait key
can i scream