append to add info in a file?

Blitz3D Forums/Blitz3D Beginners Area/append to add info in a file?

Santiworld(Posted 2011) [#1]
Hi, I need to create a log file, adding info without loosing old data.

how can I write a file without loosing the old file data?

I remember that in qbasic, the function "append" used to do that.


regards!.


Warner(Posted 2011) [#2]
Use OpenFile instead of WriteFile. Next, use SeekFile/FileSize to seek to the end of the file. Then, you can add data to it.


Santiworld(Posted 2011) [#3]
yeap!

thanks Warner!

file = openfile(filename$)
seekfile (file,filesize(filename$))
writeline file,"APPENDING TEXT LINE"
closefile file

works!!!

Last edited 2011

Last edited 2011