03-02-2019 08:57 AM - edited 03-02-2019 08:58 AM
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
03-03-2019 11:02 AM
kindly give me some hints of that problem
03-03-2019 12:03 PM
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?
03-04-2019 07:53 PM
Thanku Sir can u explain with some code example
03-06-2019 11:30 AM
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.