Hey guys,
Just wondering if you could help me out. Don't want to post the whole script so heres the necessary snippets:
Code: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;Whenever I run it, this is the error I get:Code:SaveDataToFile('C:\Simba\Scripts\Logs', mailfirstname + IntToStr(k) + mailextension);
Not sure why its trying to ReWrite the file straight off.. any suggestions?ReWriteFile - Exception. Could not create file: C:\Simba\Scripts\Logs
Error: Exception: Invalid FileNum passed: -1 at line 84
Thanks guys





Reply With Quote







