http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
c++
Redirect std::cout to a file
Redirect std::cout to a file, or t-split it so that the output goes both to the console and a file:
Simpler way to redirect–just assign a file output stream to std::cout (I didn’t check if it works, though):