04-30-2012 02:07 AM - edited 04-30-2012 02:09 AM
Hi All !
I write some data to a file, but before i do it i want to clear the file from previous content.
Surprisingly i didn't find any control/function to do the operation.
I'm using LV 7.1.
Solved! Go to Solution.
04-30-2012 02:34 AM - edited 04-30-2012 02:35 AM
04-30-2012 02:42 AM
Since you have the Path to the file you want to replace in the 'WRITE' case you coud use the 'Delete.vi. in 'Advance File Functions' Bottom right in the FILE I/O section of the Programming pallette.
04-30-2012 02:48 AM
Create or replace option pops-up a dialog. Delete is an option, also in C/C# it's quite a simple operation to clear a file.
04-30-2012 02:54 AM - edited 04-30-2012 02:55 AM
It's OK! There is a flag to suppress pop-up dialog. Thanks a lot!
04-30-2012 02:57 AM
Hi John,
"Delete is an option, also in C/C# it's quite a simple operation to clear a file."
Either use the Delete function or try the SetFileSize/SetFilePosition functions...
How would you do that in C/C++/C# anyway?
04-30-2012 03:08 AM - edited 04-30-2012 03:10 AM
"How would you do that in C/C++/C# anyway?"
It's library functions but I think on a low level it goes like this (it's pseudo code):
while(!EOF)
{
clear(or replase) char at position;
increment position;
}