Why can I not delete my test file? 
Author Message
 Why can I not delete my test file?

Mike: Yes, I agree, the code is buggier than an ant farm elsewhere. My
10 second modification eliminates the error generated by the "delete
file", which was the original question.

Actually, the "write chars to file.vi" opens and closes the file and
no error is generated even if it has been opened elsewhere earlier.
ugly!  If both instances are closed, the delete can proceed.



Fri, 02 Dec 2005 14:29:18 GMT  
 Why can I not delete my test file?
Actually the main program simulates my needs in the real application.
As my testing progresses I will be having to rewrite the data to the
file many times. The true application is conducting a very long test
and I need to periodically undate the test data file in the event the
test aborts. If I could rewrite the text file in place it would be
great. However, being a text file I don't believe that is possible.
Thus I will be closing the file deleting it and rewriting it.

All suggestions are appreciated.



Fri, 02 Dec 2005 20:26:12 GMT  
 Why can I not delete my test file?
Actually you can use the "Flush File" function that writes any cached
data on disk and updates the directory entry of the file. In the event
of an unexpected abort, the you'll recover the file from the last
Flush. After the fulsh you resume normal write operations to append
new data.

When you open an existing file to append data, you can position the
file marker to the end of the file. That leaves existing data on the
file and following writes on the file are appended to the end. Use the
advanced file function "Seek" to position the file marker at the end
of the file.



Fri, 02 Dec 2005 21:28:14 GMT  
 Why can I not delete my test file?
Quote:
>Actually, the "write chars to file.vi" opens and closes the file and

no error is generated even if it has been opened elsewhere earlier.
ugly!

By default, labview opens files with deny mode "none" e.g. other
processes are allowed to open/read/write the file simultaneously. Not
only is this seldom required but it causes errors when the file is
opened for a long time. Other applications like Office FastFind, virus
scanners and backup applications can try to access the file while you
are using it. And when they open the file they can actulally deny you
further access to the file the time they use it, causing errors 8 in
your application.

The best practice is to open the file with deny mode "Deny write/read"
that gives you exclusive access while you are using it. Unfortunately,
high level file VIs like "Open/Create/Replace File.vi" don't allow to
select the deny mode and use the default "deny none".



Fri, 02 Dec 2005 21:16:33 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Why (or why not) one module per file?

2. Why is delete-if-not deprecated?

3. It's not bad canned meat...

4. It's not bad canned meat...

5. It's not bad canned meat...

6. It's not bad canned meat...

7. why doesn't r5rs define delete-file ?

8. Deleted procs not deleted???

9. delete or not to delete

10. File Delete does not work in W2000

11. How to allocate and delete files when NOT running under TSO

12. Temporary files not getting deleted (or created!)

 

 
Powered by phpBB® Forum Software