Global Replacement of cout

I have a program with lots of couts. Now I'm wanting to save the output to a text file, so I need to replace each cout with fout (my declared command for my output file). Is there a way to globally replace "cout" with "fout" so I don't have to go through and manually change each one?
It really isn't that much trouble once you've mastered the mystical "Search and replace" functionality of whatever editor you're using.
Are you aware that you can redirect stdout/cout to file when you run the program by writing > filename after the command?

 
./your_program > output_file

http://en.wikipedia.org/wiki/Redirection_%28computing%29#Redirecting_standard_input_and_standard_output
Last edited on
Topic archived. No new replies allowed.