0

Hi,
I just wonder if this is possible:
(semi-pseudocode (won't work as planned))
ofstream fout("my_file.txt");
fout << cout;
Looking forward to your reply

6
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by Narue
0

Hi,
I just wonder if this is possible:
(semi-pseudocode (won't work as planned))
ofstream fout("my_file.txt");
fout << cout;
Looking forward to your reply

I don't think thats possible if I properly understand what you are asking....

0

Yes, what I mean is if is possible to "copy" contents any ostream to another ostream like this:
ostream out1 , out2;
//...add something to first one
out2 << out1;
I wonder if it's pos.

1

When the hoops you have to jump through to get this kind of behavior through the library are both advanced and somewhat obscure, one wonders what's so hard about manually writing to fout each time you write to cout (or calling a function that does it for you)...

Votes + Comments
Simple and clever :)
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.