Is it possible to Read a File that is "In Use"?

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I am using a 3rd party app that is constantly writing to a text log
file. I would like to monitor that file with another app, but I keep
getting the dreaded "in use" error when I try to read the file.

I have tried using the "FileMode.Open, FileAccess.Read,
FileShare.ReadWrite" parameters of the FileStream Object, but still no
luck.

Anybody know of a solution?

Thanks!
 
Joe said:
I am using a 3rd party app that is constantly writing to a text
log file. I would like to monitor that file with another app, but I
keep getting the dreaded "in use" error when I try to read the
file.

I have tried using the "FileMode.Open, FileAccess.Read,
FileShare.ReadWrite" parameters of the FileStream Object, but still
no luck.

Anybody know of a solution?

Open it in readonly mode is already the best you can do. If you still can't
open it, the other app locked it also for read operations. There is no way
around.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
This will happen because the other application opens exclusively and locks
it. I have a similar problem with a 3rd party app, although I do not need
to read the file "on demand", I can sit a timer that keeps checking the file
to see if it is no longer in use.
 
Back
Top