About outputting to a file

Is there anyway to output to a file by having one command at the end of the program instead of having to put couts to that file all over the program?
Topic archived. No new replies allowed.