WriteFile()
Blitz3D Forums/Blitz3D Beginners Area/WriteFile()
| ||
WriteFile and writeString etc. Always seems to overwrite the existing document or write over the first line. I am trying to make a logfile that records certain game activity. Becasue my game also reads and writes to other streams, it's probably not ideal to keep the file open(???) dunno though, because all the opening/closing etc could slo things down, maybe? Here's the function Im using anyway, it's very basic... |
| ||
Use OpenFile() instead. |
| ||
HAHAHA! Simple as that eh? Thats what happens when you spend a few months away from programming!!! Next I'll be asking how to print "Hello World!" :) Cheers! |
| ||
i think thats what its supposed to do, just "create a file and write this data" if you use openfile it doesnt create a new file but allows you to edit bits of the file instead. always closefile after a openfile/writefile/readfile to free up memory, its doesn't slow anything down. |
| ||
Still didn't seem to work, however, I put some extra bits in (and remembered my carriage return with WriteLine instead) this works!!! |
| ||
I wrote a tutorial a long time ago on the subject: http://www.blitzbasic.com/Community/posts.php?topic=27896 |
| ||
Use Openfile to open a file, then use (SeekPos?) along with (FileSize?) to position the "write pointer" at the end of the stream. Then continue to write using write<whatever> :) |