From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

When you use "write to file" does the data get saved to hard disk.

When you use "write to file" does the data get saved to hard disk. I.e. if my PC crashes, will data written up to then be safe or do I have to close the file after each write?

if I have to close file, if I open the same file can I append the data or should I use different file. I will be acquiring data for 8 hours every 30 seconds, would like to save data atleast every five minutes.
0 Kudos
Message 1 of 2
(2,171 Views)
On write operation, the data is not written immediately on file; it is buffered. The entry (e.g. file size) in the directory is not updated neither so if there is a crash the file may be left empty.

Instead of closing the file, you can use the Flush File function once in a while. This function writes any buffered data on disk and updates the directory entry so the data already there is pretty safe if there is an "unexpected termination" without closing the file. The Flush function does not affect the file current offset so the new data written is appended.

One supplemental precaution when opening the file for writing is to wire the deny mode input to "deny read/write". By default, "Opene File" function allows other apps to open the same file for simul
taneous read and write. This is seldom required. "Deny read/write" prevents other applications like MSOffice FindFast or antivirus scanning to open your file for indexing and denying your app further write access and causing write errors.


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 2
(2,171 Views)