use
FileStream fs = new FileStream("C:\foo.txt", FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
That may work for you. The point of using FileShare is that you want to
share the read/write permission with anyone else who needs the file. (It's
counterintuitive, I know).
If the other app didn't lock the file, you should be able to read from it.
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Otik" <Ot**@discussions.microsoft.com> wrote in message
news:9E**********************************@microsof t.com...
Hi,
I'm trying to open a file with read access only, e.g. FileStream fs = new
FileStream("C:\foo.txt", FileMode.Open, FileAccess.Read); The file is
open by another process and the FileStream constructor throws an IOException.
I thought that it was possible to open a file with read access even if it's
being used by another process. Is that not true?
Thanks,
Otik