I need to write all my program output to a text file. I believe it\'s done this way,
sOutFile << stdout;
where sOutFile is the ofstr
If you want all output in a text file you don't need to code anything extra.
from the command line:
program > output.txt
If you only wish to redirect certain output you can use ostream as dirkgently suggested.