C
clintp
In C, I'm creating a log file like this:
upd = _fsopen(outputFile, "wt", _SH_DENYNO));
// writing... Here's a sample.
fprintf(upd, "Sample contents");
fclose(upd);
In another thread -- in the same process -- I'm attempting to open this
file with:
FileStream fs = new FileStream(convertFile, FileMode.Open,
FileAccess.Read, FileShare.Read);
Which is throwing:
The process cannot access the file '[your file here]' because it is
being used by another process.
A first chance exception of type 'System.IO.IOException' occurred in
mscorlib.dll
As far as I can tell, I'm doing everything right. In the C code, I'm
leaving the file as open for sharing as I possibly can, and in the C#
I'm opening it with the right flags.
upd = _fsopen(outputFile, "wt", _SH_DENYNO));
// writing... Here's a sample.
fprintf(upd, "Sample contents");
fclose(upd);
In another thread -- in the same process -- I'm attempting to open this
file with:
FileStream fs = new FileStream(convertFile, FileMode.Open,
FileAccess.Read, FileShare.Read);
Which is throwing:
The process cannot access the file '[your file here]' because it is
being used by another process.
A first chance exception of type 'System.IO.IOException' occurred in
mscorlib.dll
As far as I can tell, I'm doing everything right. In the C code, I'm
leaving the file as open for sharing as I possibly can, and in the C#
I'm opening it with the right flags.