LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does Open File function work properly in Labview but in Linux?

I have a serious problem with this fucntion!I am using this function to avoid other vis open this file if the file has been opened before.
I used it in Labview Linux and it doesn't work. I
n Windows I don't have any problem and the second time I opened the file an error appeared if some vi has opened it before, but in Linux the message error is always OK, although the file is opened.
I am thinking that maybe it is a problem relative to Linux permission, but I need a solution because if other vi is changing the file and I am changing the file at the same time, only the last one that closes the file is going to save the changes, and the function Open File doesn't tell me that other vi has opened the file!!


Do you know a solution? do you know why Open File doesn't work?
Thanks in advanced!!!

Graci
0 Kudos
Message 1 of 7
(3,104 Views)
Hi Graci,

What are your settings for the 'Open file' function? Do you have
"read/write" and "deny read/write" set for the 'open mode' and 'deny
mode' parameters, respectively? Also what are the permission settings on
the file? (do an 'ls -l')

I haven't tested this on Linux yet. Just assumed it worked. I'll test it
soon though ... now that you mentioned it.

If it continues to fail, you can always use semaphores (mutex) to prevent
other VIs from writing to the file. It's a hack but it would definitely
work.

-kevin
0 Kudos
Message 2 of 7
(3,103 Views)
Hi Kevin,

My settings for the "Open file" function are "read/write" (open mode) and "deny read/write" (deny mode).
I have checked the permissions of the file, and this function generates an error when the file is opened by an user without permission. But I want to know if someone has opened the file before, I know that an user without permission can't open a file.
If you can test the function on Linux I would thank you enormously!

Thanks!

Graci
0 Kudos
Message 3 of 7
(3,102 Views)
On Mon, 19 Jul 2004 01:50:42 -0500, Bichillo wrote:
> If you can test the function on Linux I would thank you enormously!

Certainly. Send it over to k.valentine AT verizon DOT net.

I may not get to it right away but I'll let you know when I find
something. I'm thinking there may not be a clean solution. For now, you
may want to try the semaphore option. It's pretty easy to apply. If you
aren't familiar with it, I'll show you using your app.

-kevin
0 Kudos
Message 4 of 7
(3,102 Views)
Hi Kevin,

Thanks for your help, but I have a question.
What is AT verizon DOT net?
I will try the semaphore option. A semaphore can be a variable that changes when someone open the file , when other user tries opening the file. Before opening it, he will check the value of this variable to see if someones has opened it before. Is this a semaphore, isn't it?

Thanks!

Graci
0 Kudos
Message 5 of 7
(3,102 Views)
Just to let you know, the "AT verizon DOT net" thing is a common ploy to avoid receiving spam (autonomous programs often scan forums looking for _____@____.__ format strings, recording them as e-mail addresses). Just change AT to @ and DOT to . to get his e-mail.


As for semaphores, that's essentially what semaphores are: start the variable at zero, increment when someone accesses it, decrement when finished. If it's positive when you want it, go into a queue. You can find plenty of good explanations on Google to get a clearer idea if you're uncertain.

~DVA
0 Kudos
Message 6 of 7
(3,102 Views)
Thank for your explanation about "AT" and "DOT"!!

I was thinking about semaphore solution, and the problem is that I have two processes running and both write in this file, so I think that it is not possible to use a variable between both processes.
Other solution is using a flag file, when someone open the file, create a file, and if other wants to open it, he will have to check if this file has been created, to know if someone is using the file.
But it is not a good solution, because I am using a embedded PC, so I am using a flash, so the numbers of writing is limited.

Thanks for your help!

Graci
0 Kudos
Message 7 of 7
(3,100 Views)