How to append text in end of row, without reading the text file?

  .net, c++, windows

I have a text file whose data could look like this.

data0 ; data1 
10000 ; 88282
55002 ; 75555
10002 ; 22550
22222 ; 58799
....
78954 ; 54647

Then I want to add data to it, which will make the file look like below.
The data that was in the file should never change.

data0 ; data1 ; data2
10000 ; 88282 ; 51485
55002 ; 75555 ; 48526
10002 ; 22550 ; 47892
22222 ; 58799 ; 36258
....
78954 ; 54647 ; 58429

I want to add data to every line.
I know you could do this by reading the entire file. Then add the data to this and then write it back to the file. But the problem is that I will have a lot of data.
If I have to read out and write back all this data every time, this takes too much time.

Hence I wondered if there is no method to add data on a particular line without having to read out all data first.

Source: Windows Questions

LEAVE A COMMENT