Read Locked Files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
Isn't it even possible to copy such a file?

Willy Denoyette said:
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 said:
Isn't it even possible to copy such a file?

:

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.
 
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
 
Back
Top