One C++ program is filling a logfile, it keeps a handle to the logfile. I want to open this logfile with a C# program and parse it to see if a certain line has been added to the logfile.
However, if I open the logfile with C# I get a "this file is being used by another process" IOException. Code used:
using(StreamReader reader = File.OpenRead(myFile))//IOException
The C++ program opens the file with (I can not change the C++ program):
m_hFile = tsopen(m_csFilePath,
_O_WRONLY|_O_APPEND|_O_TRUNC|_O_CREAT|_O_BINARY,
_SH_DENYWR,
_S_IREAD | _S_IWRITE);
Opening the file with notepad works fine so it should be possible to open it. Can I force my C# program to open the file in readonly mode?