473,394 Members | 1,739 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,394 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 1811
"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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.