07-31-2009 04:09 AM
Hi All,
I want to replace a particular line in csv file programatically....
Can anyone help me in this regard.......
Thanks in Advance,
Harika
08-04-2009 07:54 AM
08-05-2009 12:11 PM - edited 08-05-2009 12:12 PM
Your question is posted in LabWindows/CVI forum. I assume you want to know
how to do it in CVI.
1) Open the csv data file by using OpenFile() function to read and write.
Be sure to select "truncate" setting for data writing.
2) Use ScanFile() function to read all the values into an array from the csv file.
Please see the examples provided by CVI Help by searching
"ASCII File with Comma-Separated Numbers to real array"
3) Replace the values that you desire in the particular line. Obviously,
you must know the number of values in your data file to do so.
4) Write the modified data back to the file using FmtFile() function.
Search "Real Array to ASCII File in Columns and with Comma Separators"
in FmtFile examples in CVI Help for more info if you are not familiar with
FmtFile().
5) Close the data file by using CloseFile() function.