|
Boost Users : |
From: Andrew Schweitzer (a.schweitzer.grps_at_[hidden])
Date: 2006-11-27 11:32:07
Is there a standard way to output to multiple streams at the same time?
I would like to pass an ostream to a function, write output strings into
that stream, and have them go to both cout and a file. I'd like
something like this:
void DoSomething(ostream& ros)
{
ros << "This goes should go to cout and to a file" << endl;
}
multi_stream ms;
fstream f("out.txt");
ms.add(cout);
ms.add(f);
DoSomething(ms);
Any suggestions?
Is this supported by the iostream library?
I took a brief look at iostream doc and without really absorbing it, it
doesn't seem to directly support this functionality. Maybe I need to
read more carefully.
Thanks,
Andy
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net