473,320 Members | 2,133 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.

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 5467
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: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: 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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.