Appended mode ?

T

tvn007

Below is my code:

ofstream out(Results);
if (!out.is_open()){
cerr <<"Cannot open file" "" <<Results<<endl;
exit(EXIT_FAILURE);


However, everytime I run the program, it wipes out previous data.
Is there an "append mode?

thanks for any help.
 
V

Victor Bazarov

Below is my code:

ofstream out(Results);
if (!out.is_open()){
cerr <<"Cannot open file" "" <<Results<<endl;
exit(EXIT_FAILURE);


However, everytime I run the program, it wipes out previous data.
Is there an "append mode?

What does your FM say about 'ofstream' constructors? Hint: there is
the second argument that controls the mode in which the file is opened.
HintHint: std::ios::app

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top