I'm not quite sure what you're looking for, but is this what you want?
open to write
close file
You can use different write commands to write different things to the file. Here is a list of the commands
write byte
write word
write long
write float
write string
write fileblock
write filedir
And here is a small example:
rem file read and write example
rem by TheComet
rem global variables
global a_byte as byte
global a_word as word
global a_long as dword
global a_float as float
global a_string as string
rem set variables
a_byte=rnd(255)
a_word=rnd(65535)
a_long=rnd(4294967295)
a_float=rnd(4294967295)-2147483648
a_string="hi, I am a string"
rem print current values to screen
print "Before writing"
print "=============="
print
print "byte : "+str$(a_byte)
print "word : "+str$(a_word)
print "long : "+str$(a_long)
print "float : "+str$(a_float)
print "string : "+a_string
rem delete file if it already exists
if file exist("test.bla") then delete file "test.bla"
rem open the file for writing
open to write 1,"test.bla"
rem write a byte to it
write byte 1,a_byte
rem write a word to it
write word 1,a_word
rem write a long to it
write long 1,a_long
rem write a float to it
write float 1,a_float
rem write a string to it
write string 1,a_string
rem close file after writing
close file 1
rem ==========================================================
rem = This is where we read the file
rem ==========================================================
rem open the file for reading
open to read 1,"test.bla"
rem read the byte
read byte 1,a_byte
rem read word
read word 1,a_word
rem read long
read long 1,a_long
rem read float
read float 1,a_float
rem read string
read string 1,a_string
rem close file after reading
close file 1
rem print current values to screen
print
print
print "After writing"
print "=============="
print
print "byte : "+str$(a_byte)
print "word : "+str$(a_word)
print "long : "+str$(a_long)
print "float : "+str$(a_float)
print "string : "+a_string
print
print "Press Any Key to Exit"
rem wait for input
wait key
rem end program
end
Hope this helps, I don't know if the above code works, I just wrote it without compiling...
TheComet