add a new text line to an existing file

BlitzMax Forums/BlitzMax Beginners Area/add a new text line to an existing file

Hi
how to add a new text line to an existing file without delete the previous informations ? Test this :

OutFile = WriteFile( "MyTest.txt" )
WriteLine OutFile, "one string."
WriteLine OutFile, "another one."
CloseFile OutFile

OutFile = WriteFile( "MyTest.txt" )
WriteLine OutFile, "i want add this without delete the previous"
CloseFile OutFile


this produce this into the file :
i want add this without delete the previous

i want :
one string.
another one.
i want add this without delete the previous


Thanks

Use OpenFile instead of WriteFile.

You may also need SeekStream and StreamSize to set the file position to the end of the file.

Local Stream:TStream = OpenStream(filename)
SeekStream(Stream, Stream.Size())
WriteLine(Stream, text)
CloseStream(Stream)