Easy way to append to file?
BlitzMax Forums/BlitzMax Programming/Easy way to append to file?
| ||
Is here an easy way to append to a file instead of having to read it all in, add an extra line, then save it all back to disk again? thx |
| ||
I think you can use SeekStream with StreamSize to move the pointer to the end, use WriteLine (or whatever) then close the file. |
| ||
sounds logical. Will test. Thanks. |
| ||
Found this here some time ago:Function appendtext:String(filename:String, text:String) If FileType(filename) = 0 Then CreateFile(filename) Local Stream:TStream = OpenStream(filename) SeekStream(Stream, Stream.Size()) WriteLine(stream, text) CloseStream(stream) End Function bye MB |
| ||
You might need a "~n" as well. |
| ||
Perfect, thanks all! |