I'm trying to embed some text read from a file into an Inno installer. Ideally this will happen in the pre-processor (ISPP) so the text cannot be modified. I am able to read the text but cannot get any newlines to display:
#define FileHandle
#define FileLine
#define ReadmeText ""
#for {FileHandle = FileOpen("README.txt"); FileHandle && !FileEof(FileHandle); FileLine = FileRead(FileHandle)} ReadmeText = ReadmeText + FileLine
#if FileHandle
#expr FileClose(FileHandle)
#endif
I've attempted to insert special characters when appending each line, but none appear to work in the pre-processor (e.g. '\n', '%n', '#13').
I'm adding the text to a TMemo
field, currently using:
Memo.Text := '{#ReadmeText}';
If I could parse the file into an array of lines, it might be possible to use the Memo.Lines.AddLine()
function, but I'm not sure if it is possible to create a variable sized array in the pre-processor and then to use it in the Pascal scripting.