I have two programs running on windows. Program A is written in C. Program B is written in managed C#.
(1) opens a file:
_fsopen(szFileName, "w", _SH_DENYNO);
(2) writes data to this file.
Program B should open and read this file simultaneously while program B writes to it. Program B tries to open the file like this:
fs = new FileStream(FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
This line throws the exception:
"The process cannot access the file because it is being used by another process"
What is wrong? I could I fix that?