LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a way for Labview to take control of a file that is already in use

Is there a way in LabView to programatically take control of a file in use by another process?  I wish to write data to files that may be opened by another process, this data is time sensitive and acquired continuously so having my process wait until the file is available is not feasible.

 

There should not be any other software accessing these files but sometimes windows is looking at them for some reason and I'm not sure how to make windows let go of them.  This does not accur often but it is annoying.

0 Kudos
Message 1 of 13
(1,760 Views)

I don't think that you gan steal access but,

you can use "Deny Access" on the adv file fns pallet to programatically prevent other access to the file


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 13
(1,741 Views)

Axehandler wrote:

...

 

There should not be any other software accessing these files but sometimes windows is looking at them for some reason and I'm not sure how to make windows let go of them.  This does not accur often but it is annoying.


Could be virus checking or FindFast (disk indexing). have you concidered simply retrying after the error?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 13
(1,726 Views)
Never thought of the indexing service, I will try disabling that.
Message Edited by Axehandler on 05-29-2009 06:40 PM
0 Kudos
Message 4 of 13
(1,705 Views)

It doesn't appear that the indexing service is causing the issue.  Is there a way to find out which program/service might be opening these files?

 

I have excluded the folders in question from Virus Checking.

0 Kudos
Message 5 of 13
(1,703 Views)

What files are these--text, binary or VIs?

 

Ipshita C.

National Instruments
Applications Engineer
0 Kudos
Message 6 of 13
(1,657 Views)

Axehandler wrote:

Is there a way to find out which program/service might be opening these files?


 

 

Yes, use handle or process explorer from sysinternals. (see also).

 

How is your labVIEW program structured? Could it be that your LabVIEW program itself holds on to the file from e.g. a previous file IO operation? Make sure references don't become invalid (e.g. via a "use default if unwired output tunnel) which would prevent the file from getting closed properly for example. Your program should open the file once at the start of the program and keep it open for the duration of the run. This way you should not have any intermittent problems accessing it.


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 7 of 13
(1,644 Views)

altenbach wrote: 

 

How is your labVIEW program structured? Could it be that your LabVIEW program itself holds on to the file from e.g. a previous file IO operation? Make sure references don't become invalid (e.g. via a "use default if unwired output tunnel) which would prevent the file from getting closed properly for example. Your program should open the file once at the start of the program and keep it open for the duration of the run. This way you should not have any intermittent problems accessing it.


Data is being collected every second and then written to a binary file every 10 minutes. The access errors occur infrequently but when it does then I loose 10 minutes of data on that channel. Not a killer just annoying.  I believe I have figured out which process is responsible but unfortunately it's a data backup system, which I need to be running.  So my original question remains.

 

There is no way to force a labview VI to wrench control of a file from another process programmatically?

0 Kudos
Message 8 of 13
(1,616 Views)

For how long does that backup process hold on to the file?

 

Perhaps you should detect the error, pass the array of into a queue to hold onto.  And try again later.  If it fails again, put the data back into the front of the queue.

Message 9 of 13
(1,612 Views)
The Data is time sensitive.  The unit collecting the Data is dumb just relays the data to the pc. So I am time stammping it as the data comes in and i'm having issues with the time stampping if i hold it for writting later.
0 Kudos
Message 10 of 13
(1,600 Views)