LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

File Closed - but Windows doesn't agree

Even after I use the Close File function, and write the Empty Path constant to my path indicator, I still can't rename or delete the file unless I close LV. I've also tried Flush then Close. Any ideas? How do you get LV to stop holding a file hostage?

Message Edited by Broken Arrow on 09-29-2005 09:37 AM

Richard






0 Kudos
Message 1 of 20
(4,623 Views)
This has not been my experience. Could you attach a simple example that demonstrates the problem?
 
Is the file local or on a network resource?
0 Kudos
Message 2 of 20
(4,606 Views)
Thanks for your offer to help. It was a large VI, so I've worked it down to this level to demo the problem.
Click on Start a New Logfile (enter a name for the file, hit ok)
Then hit the Stop/Start button.
Increment the Numeric a few times to write some zeros to the file.
Hit Stop/Start again.
Then hit "unload", which should close the file.
Then, with the vi still running, try to change the name of the created file. Windows will say it's being used.

Richard






0 Kudos
Message 3 of 20
(4,594 Views)
Your demo requires a VI called CHANGED DBL, which was not included.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 20
(4,588 Views)
There's always SOMETHING. That vi is attached.  Smiley Happy
Richard






0 Kudos
Message 5 of 20
(4,581 Views)
Why is your event structure reacting to a MOUSE UP event on the UNLOAD button?

I would normally use a VALUE CHANGED event.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 6 of 20
(4,581 Views)
Note sure what you're trying to do.

Your START NEW FILE function creates a NEW file (will fail if it exists already), and leaves it open.

Your UNLOAD function opens ANOTHER reference to he same file, then closes it.
You opened the file TWICE, but closed it ONCE.

It's still open.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

Message 7 of 20
(4,579 Views)
No reason other than it works for me. I think I had a control where that HAD to be the case, and I just kept doing it. Value Changed makes more sense.
Richard






0 Kudos
Message 8 of 20
(4,577 Views)
CoastalMaineBird - how do you get a refnum of the file, in order to use the Close function, without using the Open function?
Richard






0 Kudos
Message 9 of 20
(4,576 Views)

I think the problem is that you open multiple file references to the same file, but close only one.

The "write characters to file" Opens the file with a new reference at each call and closes it again after writing. You should open the file once and keep it open, it would be more efficient.

For the option "Start New File", you open a new reference that you never close anywhere!

In the unload option, you again open a new refnum, and close it immediately. This servers no purpose. It does not close the reference opened by the "NEW" node, just the one it created a nanosecond earlier. 😉

Try to place a close right after the NEW for a dirty patch of the problem.

For a better solution, open or create the file once and then keep the file reference in a shift register. Write using low level VIs without ever closing the file, except when unloading.

Message 10 of 20
(4,526 Views)