Reading/Writing files

Blitz3D Forums/Blitz3D Beginners Area/Reading/Writing files

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I wish to include a log file for my game - which will recird chat messages/system notes etc.

I had assumed it's not a good idea to keep the stream open ALL the time, so it will be opened, written to, then closed again each time.

This causes a problem if I need to add consecutive lines later, as each time I open it, the 'pointer' moves to the start of the file.

The immediate workaround I thought of was to read the contents each time, then re-write. Thjis of course, would take too long with large logs and defeat the object of having the file...

Is there a simple way to 'move' to the EOF?

here's my trial code:

Graphics3D 800,600,32

;CLEAR LOG FOR NEW GAME
debug=OpenFile ("Log.log")
While Not Eof (debug)
WriteLine debug,""
Wend

WriteLine debug,"START OF LOG"
CloseFile debug

;LATER ON - CONSECUTIVE LINE

sphere=CreateSphere(10)

debug=OpenFile ("Log.log")
WriteLine debug,"Created Sphere"
CloseFile debug