LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Properly close file from Write Delimited Spreadsheet ?

I did not realize the Write To Text File would create a file if it didn't exist.  And it looks like it replaces a file that does exist.  ***Looks in the help***  Wow!  How did I miss that?

 

But you shouldn't have to use the Close File after it.  If the refnum out is not wired on the Write Text File, the function will close the file.  I'd be interested in seeing if this works in your situation.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 14
(506 Views)

Hi crossrulz,

 

Thank you for your kind help, but I think the issue is with Write to Delimited Spreadsheet, not Write to Text File. Either it creates or closes a file is not causing the problems, but thank you for clarifying that.

 

Also, I'd like to mention that even though some functions like Write to Text, or Write to Delimited Spreadsheet may actually or claim that they close the file after writing it, this "close" is in the context of LabView, which means the refnum is released and/or the cache become unsecured in the OS, and the OS may be able to deal with it, but it doesn't really promise that the OS can read it immediately, that is why I use a "redundant" Close File function to tell the OS that this file is now ready to be ready, i.e. ready to be cached to OneDrive or updated to whatever other platforms. So it's an issue outside the scope of just LabView, it is related to the OS I think.

0 Kudos
Message 12 of 14
(492 Views)

@princelog
for some reason, your solution doesn't work for me yet.
I wrote to text file, close file with proper refnum, but Onedrive is still not syncing until after I quit Labview.

0 Kudos
Message 13 of 14
(481 Views)

Sorry all, it turned out it's my mistake. Labview is fine.

My mistake was:

ngthai_1-1700744809253.png

 

I didn't know that I need to close the file before Writing. The Writing Delimited Sp will then do both Opening/Closing file.

ngthai_0-1700744750425.png.

 

0 Kudos
Message 14 of 14
(429 Views)