One C ++ program fills a log file, it holds a log file descriptor. I want to open this log file with a C # program and analyze it to see if a specific line has been added to the log file.
However, if I open the log file using C #, I get "this file is being used by another process" IOException. Used code:
using(StreamReader reader = File.OpenRead(myFile))
A C ++ program opens a file with (I cannot change a C ++ program):
m_hFile = tsopen(m_csFilePath,
_O_WRONLY|_O_APPEND|_O_TRUNC|_O_CREAT|_O_BINARY,
_SH_DENYWR,
_S_IREAD | _S_IWRITE);
Opening a file with notepad works great, so you can open it. Can I make a C # program open a file in readonly mode?
source
share