سؤال

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