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!

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top