944,045 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 4871
  • C++ RSS
Oct 16th, 2007
0

[C++] append() to each row of a text file

Expand Post »
Hello.. is it possible to append some data on a text output file appending the data to each row, and without use too much computational I/O ??

Instead of the classical way:

C++ Syntax (Toggle Plain Text)
  1. VARX VARY VARZ...
  2. year1 x1 y1 z1
  3. year2 x2 y2 z2
.. I would like to use the much more redeable:

C++ Syntax (Toggle Plain Text)
  1. year1 year2 ..
  2. VARX x1 x2 ...
  3. VARY y1 y2 ...
  4. VARZ z1 z2 ...
  5. ...
where the 1,2 series are wroted on different times.. a sort of a appendByRow() function.. and I would avoid of load the whole file in memory and then printing it line-by-line..

is it possible ??
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
sylvaticus is offline Offline
4 posts
since Sep 2006
Oct 16th, 2007
0

Re: [C++] append() to each row of a text file

>I would avoid of load the whole file in memory and then printing it line-by-line..
Read a line, process it, and write it to a temporary file. Then delete the original file and rename the temporary.

>is it possible ??
It's hard to say. You talk about appending to a row, but your description of the desired result suggests that you want to transpose a matrix, which makes your storage and performance requirements more difficult to meet.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Cable Bill Program
Next Thread in C++ Forum Timeline: Try to determine maximum and minimum values - and how many times they appear





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC