Inno Setup Preprocessor: SaveStringToFile

Prototype

int SaveStringToFile(str Filename, str S, int? Append, int? UTF8)

Description

Saves the specified string to the specified file. If Append is True or ommitted and the specified file already exists, it will be appended to instead of overwritten. If UTF8 is True or ommitted, the string will be saved with UTF8 encoding instead of ASCII encoding. Returns True if successful, or False otherwise.

This function does not automatically write a line break before or after the string. If Append is True or ommitted and the existing file did not end in a line break, the function will effectively append to the existing last line. To avoid this you can put line break characters (using NewLine) before and/or after your string.

Example

#expr SaveStringToFile('c:\filename.txt', NewLine + 'the string' + NewLine)