Question

Possible Duplicate:
Read file which is in use?

I am trying to access a file that is already in use in Windows 7. I have tried all the suggestions I could find on this site and other but no success yet.

What I have tried:

FileStream fs = new FileStream(iFile, FileMode.Open, FileAccess.Read, FileShare.Read);
FileStream fs = new FileStream(iFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
FileStream fs = new FileStream(iFile, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
FileStream fs = new FileStream(iFile, FileMode.Open, FileAccess.ReadWrite, FileShare.Read);

Always the same error

The process cannot access the file 'fileinuse' because it is being used by another process.

I am open to any work arounds to this problem.

Thanks in advance for any help!

Was it helpful?

Solution

If another process opens the file in "exclusive mode" then you cannot get access to the file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top