05-29-2009 11:32 AM
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.
05-29-2009 01:45 PM
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
05-29-2009 02:57 PM
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
05-29-2009 06:39 PM - edited 05-29-2009 06:40 PM
05-29-2009 06:47 PM
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.
06-01-2009 04:14 PM
What files are these--text, binary or VIs?
Ipshita C.
06-01-2009 05:41 PM
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.
06-02-2009 04:09 PM
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?
06-02-2009 04:24 PM
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.
06-02-2009 05:44 PM