• Post Reply Bookmark Topic Watch Topic
  • New Topic

Reading a text file whilst it is in use

 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using a data logging program that writes captured data out to a text file. It does this in real time, so the text file is in use during the whole time the program runs.

Is there any way I can access this text file while it is in use?

I have tried in Java, but it says the file is in use by another process. The reason for wanting to do this is because I need to use the captured data as soon as it comes in. The text file would act like a buffer between my Java program and the data logging program.

Thanks.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the other file has an exclusive lock, there's very little to nothing you can do. The operating system simply does not allow you to access the file in any way. The only option you might have is use JNI to forcibly release that lock, but you could end up breaking the other application.
 
Mikpo Siru
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. Thanks.
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!