LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

share a file

Hello,

I writing a VI application that writes encrypt and write data in a binary data file.

Is it possible to keep this file open in LV while another soft (from my own) read this data file?

The timing is :
LV write ~300 bytes every 2 minutes and my soft read a line of data when it's possible.

More generally:
what error should I expect if 2 softwares accesses the same file at the same time?

Thanks,

Manu
0 Kudos
Message 1 of 5
(2,894 Views)

hi there

you should be able to open both files at the same time. if possible only one app should write to the file. if you try to read data when there is none you get the EOF - error (errorcode = 4), so retry until FileRead returns errorcode 0.

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 5
(2,879 Views)

ah, by the way:

if you need to write the file from different apps at the same time you should lock the range you want to write using the "Lock Range" function from the file - palette. see online help for more information.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 3 of 5
(2,879 Views)
Thanks for your reply!

I asked this question because, when you open a file (let's say with Excel) and the you try to write in it with LV, you get a permission error.

You can solve that by setting the file in read-only for Excel and momentally turn its permission to write-only at the moment you write in it with labview.

That implies you create the file and change the permission to read-only before opening the file and launching LV (if else: File permission error).

Because of that, I worried if two softwares acess the same file at the same time (one to read, the other to write).
0 Kudos
Message 4 of 5
(2,874 Views)
Hallo Manu,

the problem that you decribe smells like data dependancy , which means when one or more theads ( processes,softwares etc.) is actually holding/keeping the data to modify etc. ( in your case writing to excel, and simultaniously another thead tries modify this data) , the first one will so to say try to keep the data for himself which will lead to a deadlock if the out thead still tries to modify. So the error you probably will get can be because of thoses reasons. Use unlock the range function for letting 2 or more theads to modify a data simultaniously.
About the error code , i can`t say anything but my advice would be experimental know-how  :))) which I am doing everyday :))))

have a nice day

greetings



Message Edited by Support on 11-13-2007 01:01 PM
0 Kudos
Message 5 of 5
(2,867 Views)