Old 15th August 2003, 22:39   #1
Junior Member
Join Date: May 2003
Posts: 3
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?
hshim is offline   Reply With Quote
Old 16th August 2003, 00:20   #2
Major Dude
Join Date: Mar 2003
Posts: 571
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).
pengyou is offline   Reply With Quote
Old 16th August 2003, 11:30   #3
Afrow UK
Afrow UK's Avatar
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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.

Afrow UK is offline   Reply With Quote
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump