10-14-2023 11:21 AM
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.
10-15-2023 10:17 AM
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.
10-15-2023 06:26 PM
@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.
11-23-2023 07:10 AM
Sorry all, it turned out it's my mistake. Labview is fine.
My mistake was:
I didn't know that I need to close the file before Writing. The Writing Delimited Sp will then do both Opening/Closing file.
.