dybc2125
29th October 2004 10:07 UTC
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?
kichik
29th October 2004 12:44 UTC
You don't need to read the entire file in a loop. Simply use FileSeek to seek to the end of the file.
Afrow UK
29th October 2004 14:22 UTC
Oh my, just realised that. One of my first functions D:
Updated function, added macro.
-Stu
deguix
29th October 2004 23:18 UTC
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.)