Boost logo

Boost Users :

From: Andrew Schweitzer (a.schweitzer.grps_at_[hidden])
Date: 2006-11-27 11:55:55


Eric MALENFANT wrote:
> Andrew Schweitzer a écrit:
>
>>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?
>>
>
>
> tee_device is probably what you're looking for.

awesome, thanks guys.

Man that's a fast response! :)

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