how would i go about doing the std output to a file for this line?
to be more clear i want it to append to the file not overwrite because i run the function multiple times outputting to the same file

std::outFile << "The area with the highest average temperature is #" << highestArea << " with a temperature of " << highestAreaTemp <<endl;

where outFile is defined as

ofstream outFile;

thanks in advance for any answers! :)

Recommended Answers

All 2 Replies

Seems to me you should simply open the file with the ios::app flag ("app" for "append").

See this page. Scroll down a little bit for a discussion of the available flags.

http://www.cplusplus.com/doc/tutorial/files/

std::outFile

Get the "std::" out of there. outFile is a variable that YOU created, so its not going to be part of the std namespace.

thank you very much!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.