I have an application that have a log system that create a file and keep it handle with a TFileStream, that is created with this way:
FFileStream := TFileStream.Create(FFilename, fmOpenWrite);
Ok. When I try to open this file with notepad, no problem, with notepad++ no problem. When I try to load the file with other application that I created it raise my an error that says the file is in used by other process.
I tried TStringList, LoadFromFile and TFileStream.Create(LFile, fmOpenRea);.
Some one knows how I can read this like the notepad and notepad++?
Erik got there first but uses fmShareDenyNone which would allow other processes to write to the same file. If you only want to allow reading by other processes, use:
FFileStream := TFileStream.Create(FFilename, fmOpenWrite or fmShareDenyWrite);
Use fmOpenWrite or fmShareDenyNone to enable sharing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With