Having trouble writing to a text file
Here a function I have that writes to a next file. This function is called many times because it is in a while loop. NumFiles, gets incremented, 0, 1, 2, 3, 4. The first time the function is called I want to rewrite the file, however the 2nd time I call the function I don't want it to rewrite the file... I want to keep on adding to the file.
What I have down here results in an error. Anyone know what I should do?
Thanks
What I have down here results in an error. Anyone know what I should do?
Thanks
- Code: Select all
function WriteFile
begin
if NumFiles = 0 then
begin
AssignFile(SendFile, 'c:\ProgramResults\3ParametersData.txt');
Rewrite(SendFile);
end
else
AssignFileSendFile, 'c:\ProgramResults\3ParametersData.txt');
writeln(SendFile, 'HELLOMOM');
closefile(Sendfile);
end;