This problem is really annoying me because as far as I can tell, this is the same code I've used a million times. I have the following code
It works fine as long as the file doesn't already exist and the rewrite line is called. If the file already exists and the reset line is called then any attempts to write to it result in error 105 (file not open).
Any thoughts on this?
Code:
filename := extractFilePath(application.exeName) + 'log.txt';
assignFile(log, filename);
if fileExists(filename) then
reset(log)
else
rewrite(log);
It works fine as long as the file doesn't already exist and the rewrite line is called. If the file already exists and the reset line is called then any attempts to write to it result in error 105 (file not open).
Any thoughts on this?