LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to replace a line in csv file

Hi All,

 

I want to replace a particular line in csv file programatically....

 

Can anyone help me in this regard.......

 

Thanks in Advance,

Harika

 

 

0 Kudos
Message 1 of 3
(3,515 Views)
0 Kudos
Message 2 of 3
(3,476 Views)

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.

 

 

    

Message Edited by dcl9000 on 08-05-2009 10:12 AM
0 Kudos
Message 3 of 3
(3,451 Views)