xtrapsp
2012-11-16 19:22:20
Hey guys,
Just wondering if you could help me out. Don't want to post the whole script so heres the necessary snippets:
Whenever I run it, this is the error I get:
Not sure why its trying to ReWrite the file straight off.. any suggestions?
Thanks guys
Just wondering if you could help me out. Don't want to post the whole script so heres the necessary snippets:
procedure SaveDataToFile(file,text:string);
var
SaveFile, thefile: Integer;
Str: string;
begin
if FileExists(file) then
begin
thefile := OpenFile(file,true);
ReadFileString(thefile,str, FileSize(thefile));
CloseFile(thefile);
end;
SaveFile := RewriteFile(file, False);
if str = '' then
WriteFileString(SaveFile,text)
else
begin
WriteFileString(SaveFile,str + chr(13) + text);
end;
Writeln('Saved to: '+file);
CloseFile(SaveFile);
end;SaveDataToFile('C:\Simba\Scripts\Logs', mailfirstname + IntToStr(k) + mailextension); Whenever I run it, this is the error I get:
ReWriteFile - Exception. Could not create file: C:\Simba\Scripts\Logs
Error: Exception: Invalid FileNum passed: -1 at line 84
Not sure why its trying to ReWrite the file straight off.. any suggestions?
Thanks guys