I am using TFileSteam to open a log file. I would like to be able to read this log file from other processes. I thought fmShareDenyWrite mode would allow this.
However, if I try to open the file from other processes, I get an error message. For example, if I try to enter a file from the command line, I get "the process cannot access the file because it is being used by another process."
Here is the file initialization code:
if FileExists(AutoLogFileName) then
_ActivityLogStream := TFileStream.Create(AutoLogFileName,
fmOpenReadWrite or fmShareDenyWrite)
else
_ActivityLogStream := TFileStream.Create(AutoLogFileName,
fmCreate or fmShareDenyWrite);
Note: I am using Delphi version 6.
Aheho source
share