hshim
15th August 2003 23:39 UTC
how to write at the end of existing file?
I opened a file with "a" mode to write a file.
It seems it appends the string from the beginning of the file.
I found a solution from this forum which is:
FileOpen $0 myfile a
FileSeek $0 END
FileWrite $0 "$\r$\nstring here$\r$\n"
FileClose $0
But my file is still refreshed, not appended.
Can someone help me?
pengyou
16th August 2003 01:20 UTC
You need to specify an offset in addition to 'END'. You can use
FileSeek $0 0 END
to move to the very end of the file.
But this might not always give the result you expect - it depends upon the structure of the file (e.g. does it contain an EOF marker, do the existing lines in the file use $\r$\n or just $\n to mark the end of the line).
Afrow UK
16th August 2003 12:30 UTC
You should have a look at the NSIS Archive Text File Manipulation section.
There is a script on there which will write to the end of a file everytime.
-Stu