LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to append some data in a csv text a file at a certain place in a desired row

hi guys i have text file in which have some data. i want to put value results and pass or fail values in to already opened  text file. for example i have a lines in text file

title,sequence,dependency,lowerlimit,uperlimit,result,p/f
p,1,p4,25.5,26.5,,
l,12,p3,27,29,,

in this data i want to insert data of result and pass fail. how will i do that. i know how to open file for read and write. i want to insert data in this file at a desired location. kindly help me

 

0 Kudos
Message 1 of 5
(2,863 Views)

kindly give me some hints of that problem

0 Kudos
Message 2 of 5
(2,833 Views)

2 options:

1. Read the entire file, do the calculations and write it out again. Depending on file size, this could be the whole file, or you might have to do it line by line to a second file.

2. If you control the creation, format & writing of the file, you could make all the fields in the file fixed length, and write some zero or blank data where you want your program to place the new calculated values. You can use the standard C file position controls (ftell & friends) to write the value where you want. Unless the space is allocated when the file is first written, you will overwrite the cr/lf indicating the end of a line and corrupt the file, but you knew that already, right?

0 Kudos
Message 3 of 5
(2,828 Views)

Thanku Sir can u explain with some code example

0 Kudos
Message 4 of 5
(2,812 Views)

For basic C language tutorial, please go to an appropriate computer programming tutorial website. If you do not know any, Google is your friend. I suggest you come back here when you have a precise question concerning NI software & hardware.

0 Kudos
Message 5 of 5
(2,794 Views)