Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

Write data at beginning of new file?

$
0
0

I use the following code to create a new file and write data:

ofstream outfile("out.txt")   // line 1
outfile << "b" << endl;       // line 2
outfile << "c" << endl;       // line 3
                              // line 4
outfile.close();              // line 5

In Line 4, what code can I use here that will allow me to insert one line of text at the TOP of the two "b" and "c" lines?  I basically want to insert one line at the TOP that has a single "a" character.  I'm not sure if this is possible.

Any ideas?


jmmc


Viewing all articles
Browse latest Browse all 15302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>