From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read data from a file that is already open by another program

Hey..

I have made IV, where I'm trying to read data from a log file, that is being updated by another program while my IV runs.
To be clear, this program writes data continuously to this file and I want to read from the file in LV at the same time.

 

The problem is that LV reports an error when I'm trying to read the log file, even if I use to "read only" mode.
I believe that the program that is producing the file, have some kind of lock on the file. I have tryed to copy the file and then reading from the copied file, but LV throws already an error when I try to copy the file.

 

Has anyone tryed this, and found a solution.?

 

Additional info: The program that produces the file is STM Studio 

 

Best Regards
Allan

0 Kudos
Message 1 of 5
(2,827 Views)

Hi Alha,

 

when that file is locked by the other program you can't do anything about that - apart from quitting that other program. Probably this isn't an option to you…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,822 Views)
http://www.howtogeek.com/howto/windows-vista/backupcopy-files-that-are-in-use-or-locked-in-windows/

This is probably worth a try. We all have to jump through hoops provided by Microsoft from time to time!

I know I have not exactly given you a working solution but it may get you going

All the best
Michael
0 Kudos
Message 3 of 5
(2,810 Views)

Hey Michael

 

Thanks for the proposal..

 

It worked, but the program (hobocopy) takes to long, to copy the file,

about 10 sec. and I want to do it much faster, less then 10ms.

 

/Allan

0 Kudos
Message 4 of 5
(2,802 Views)
A friend of mine suggested tail, a linux thing. I found a possible solution here:

http://tailforwin32.sourceforge.net

Let me know how you get on here. 10ms is a tough one. I dont think a faster drive like an ssd will help get close, there is the possibility of a simulated ram drive but I guess could be problematic. Tail sounds ideal so best of luck.
Michael
0 Kudos
Message 5 of 5
(2,771 Views)