WriteFile()

Blitz3D Forums/Blitz3D Beginners Area/WriteFile()

_PJ_(Posted 2005) [#1]
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...





GfK(Posted 2005) [#2]
Use OpenFile() instead.


_PJ_(Posted 2005) [#3]
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!


markcw(Posted 2005) [#4]
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.


_PJ_(Posted 2005) [#5]
Still didn't seem to work, however, I put some extra bits in (and remembered my carriage return with WriteLine instead) this works!!!




WolRon(Posted 2005) [#6]
I wrote a tutorial a long time ago on the subject: http://www.blitzbasic.com/Community/posts.php?topic=27896


Damien Sturdy(Posted 2005) [#7]
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> :)