473,320 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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!
Nov 20 '05 #1
4 1809
"Joe" <jo***@yahoo.com> schrieb
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

Nov 20 '05 #2
"Joe" <jo***@yahoo.com> schrieb
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

Nov 20 '05 #3
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.

"Joe" <jo***@yahoo.com> wrote in message
news:60**************************@posting.google.c om...
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!

Nov 20 '05 #4
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.

"Joe" <jo***@yahoo.com> wrote in message
news:60**************************@posting.google.c om...
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!

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bill N. | last post by:
Using VB .Net 2003 Standard Edition. This simple form has a "File in Use" problem while the executable is running. Created this simple program to make sure that I hadn't done something in my...
27
by: Tom Rodman | last post by:
I want to embed a bash script inside the c program. How could you do the below bash snippet in "c"?: cat > /tmp/foo <<\__EOD_ all kinds of nasty stuff in here including single and double...
7
by: Dan H. | last post by:
Hello, What is the equivalent "string resource file" in c#? And, is there a way to create a beep in C#? Thanks, Dan
3
by: Arpi Jakab | last post by:
I have a main project that depends on projects A and B. The main project's additional include directories list is: ...\ProjectA\Dist\Include ...\ProjectB\Dist\Include Each of the include...
19
by: gk245 | last post by:
I have something like this: printf("Enter numbers: "); scanf ("%i", &number); If the user put in a bunch of numbers (like 4568), instead of just one number, i know that you can extract the...
2
by: doctorhardik | last post by:
hai all when i try create new file using fopen function in php in "W" mode. it dose not create file. Create test.php file in /var/www/html/ directory on linux machine. past this simple code:...
9
by: Mahernoz | last post by:
Hello Friends, The JavaScript File exmplmenu_var.js contains the code... (for the sake of brevity i am showing only that code which needs to be changed) I am actually developing a menu using...
8
by: eastcoastguyz | last post by:
I'm very new to RSS. I was given a URL that starts with "feed:". I want to be able to open this and read in its content into a PHP program to produce a report. I'm not interested in converting it...
5
by: TC | last post by:
Hey All, I'm trying to upload files via FTP and I'm using FtpWebRequest and WebClient. Unfortunately, I'm receiving a "Not Logged In" error. I know that others have seen this as I've seen...
1
by: gflor16 | last post by:
Here is the sample code: For Each strFile As String In My.Computer.FileSystem.GetFiles("c:\") lstData.Items.Add(strFile) If strFile.ToString.StartsWith("c:\IO")...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.