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

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!
 
A

Armin Zingler

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
 
R

Robin Tucker

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top