Archive: How to Append string(s) into a File?


How to Append string(s) into a File?
I have tried to use :

FileOpen $0 [file] a
FileRead $0 $1
FileWrite $0 "$1 $\n what i want to append"
FileClose $0

But I cant append any string into a file that contains a number of lines of string due to the string which is read from file just until a newline.

How do I append string(s) into this sort of file?


http://nsis.sourceforge.net/archive/...b.php?page=323

-Stu


You don't need to read the entire file in a loop. Simply use FileSeek to seek to the end of the file.


Oh my, just realised that. One of my first functions D:

Updated function, added macro.

-Stu


I've been thinking on having a function that:

1) Writes and reads an INI file (basic), even without a section, or value name.
2) Searches for a section, value name or value.
3) Enumerates a section so you could get a 'index'th value name or value in a section.
4) Has the ability to read value names values that have more than one line. This is not really how programs interpret an INI file, but as NSIS write it, you could read it entirely back. (That means, you use WriteINIStr "File.ini" "Section" "Value Name" "Str$\r$\nStr2" and try to read it back if it doesn't have an equal sign, "[]" at string ends and ";" as the first character as it means comment.)