SCAR Code:
program New;
procedure AddToDebug(S: String);
var
FileNum, L: integer;
P: String;
begin
AddToReport(S);
//FileNum := RewriteFile(ScriptPath+'[TEST].txt', True);
Filenum:= OpenFile(ScriptPath+'[TEST].txt', true);
if( FileNum < 0 )then
AddToReport('Couldn''t save report!');
L := FileSize(FileNum);
Writeln('File Length: '+inttostr(L));
ReadFileString(FileNum, P, L);
Writeln(P);
//
CloseFile(Filenum);
FileNum:= RewriteFile(ScriptPath+'[TEST].txt', True);
WriteFileString(FileNum, Trim(P)+S);
CloseFile(FileNum);
end;
begin
AddToDebug('Hello');
end.
The reason is because you never opened the file to "read" it, you only opened it to edit it therefor it could never "read" from the file because it wasn't supposed to.
You had the right idea, you just weren't familiar enough with the functions. Good luck and if you need any other help with scripting let me know =).