473,386 Members | 1,795 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,386 software developers and data experts.

Read Locked Files

I'm trying to read a locked log file with C# but i get an IOExeption telling
me that the file is in use by another process.

Is there a way to read the file?

the file is only 200k so if i cannot read it, is it possible to copy it to a
temp file and then read it?

please show me some examples

Cheers
// Leon
Jul 21 '05 #1
4 5468
Examples of something that isn't possible?
If the file is in use and opened for exclusive access you won't be able to
open the file.
Willy.

"Leon" <Le**@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
I'm trying to read a locked log file with C# but i get an IOExeption
telling
me that the file is in use by another process.

Is there a way to read the file?

the file is only 200k so if i cannot read it, is it possible to copy it to
a
temp file and then read it?

please show me some examples

Cheers
// Leon

Jul 21 '05 #2
Isn't it even possible to copy such a file?

"Willy Denoyette [MVP]" wrote:
Examples of something that isn't possible?
If the file is in use and opened for exclusive access you won't be able to
open the file.
Willy.

"Leon" <Le**@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
I'm trying to read a locked log file with C# but i get an IOExeption
telling
me that the file is in use by another process.

Is there a way to read the file?

the file is only 200k so if i cannot read it, is it possible to copy it to
a
temp file and then read it?

please show me some examples

Cheers
// Leon


Jul 21 '05 #3
Leon wrote:
Isn't it even possible to copy such a file?

"Willy Denoyette [MVP]" wrote:

Examples of something that isn't possible?
If the file is in use and opened for exclusive access you won't be able to
open the file.
Willy.


Think about it. To be able to copy it you (well the OS) need to read it.
And that is what is impossible if a file is in use and it's locked.

--
Rinze van Huizen
C-Services Holland b.v.
Jul 21 '05 #4
Do you open the file in read only mode ?
If not, give it a try.
If you do already then the file is likely locked exclusively making possible
to even read its content. You'll have then to wait for this file to be
closed...

Patrice

--

"Leon" <Le**@discussions.microsoft.com> a écrit dans le message de
news:80**********************************@microsof t.com...
I'm trying to read a locked log file with C# but i get an IOExeption telling me that the file is in use by another process.

Is there a way to read the file?

the file is only 200k so if i cannot read it, is it possible to copy it to a temp file and then read it?

please show me some examples

Cheers
// Leon

Jul 21 '05 #5

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

Similar topics

0
by: Neil | last post by:
Hi, I posted this on the dotnet.framework newgroup, but no one replied, so I thought maybe this newsgroup might help. I'm writing a file utility and would like my program to at least try to...
29
by: pb648174 | last post by:
I have a very long transaction that runs on the same database that other users need to use for existing data. I don't care if they see data from the transaction before it is done and am only using...
4
by: Qwert | last post by:
Hello, I have a listview with an image list. After dispoing the images and the image list, the bitmap files remain locked: REM Create. objImage = Image.FromFile(strBmp) If...
4
by: Leon | last post by:
I'm trying to read a locked log file with C# but i get an IOExeption telling me that the file is in use by another process. Is there a way to read the file? the file is only 200k so if i...
5
by: cmay | last post by:
The only examples I have seen on how to check if a file is locked is to try to open it a catch an exception. MS has stated that you should never use error trapping in this manner. Is there no...
6
by: elake | last post by:
I found this thread about a pst file in Windows being locked and I am having the same issue. ...
5
by: Glen Buell | last post by:
Hi all, I have a major problem with my ASP.NET website and it's SQL Server 2005 Express database, and I'm wondering if anyone could help me out with it. This site is on a webhost...
5
by: troy | last post by:
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query....
5
by: Markus Erlacher | last post by:
Hi Newsgroup, I have a problem that is not directly C#-related, but I'd like to solve it in C#. A data acquisition station generates heaps of data, which shall be transferred to a server. As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...

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.