Writting files....plz Help !

BlitzPlus Forums/BlitzPlus Programming/Writting files....plz Help !

Hi all :)

I wonder how to write a file when it already exists ?

I have a file with some datas.So, I want to add informations without erase existing datas....I would like to add datas at the end of this file...

how to do this ?

Thank's in advance :)

Your gonna need to ReadFile all the existing data into some variables. Next OpenFile and insert the old data along with any new stuff you want.

Erm...

I haven't used Blitz for a while but that doesn't sound right to me. You should be able to just open the file with OpenFile and then find the end using SeekFile and FileSize.

Can you not use SeekFile and Eof to move the file pointer to the end of the file, then use the file Write commands?

Like I said my Blitz is a bit rusty but something like this should do it...

Local FileName$ = "whatever.txt"
Local File = OpenFile(FileName$)
If File
    SeekFile(File,FileSize(FileName$))
    WriteLine(File," Helloooo!")
    CloseFile(File)
EndIf



If you look in Code Archives / Miscellaneous, I've posted text and data utilities that should make life MUCH easier when trying to stick data in text files and/or retrieve it.

ok thank you very much :) thx all :)