Ask your own question, for FREE!
Computer Science 22 Online
OpenStudy (anonymous):

C++: Formatting output: Is it possible that I define an output operator such that cout outputs one way and an output stream to a file (using ofstream) outputs data another way?

OpenStudy (anonymous):

I suppose you could just check for cout if(os == std::cout) { stdout stuff... } else { file stuff... } I think that will work, assuming os is std::ostream&

OpenStudy (anonymous):

Thank you very much, that worked perfectly.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!