The Boost C++ library has Function Template tee
The class templates tee_filter and tee_device provide two ways to split an output sequence so that all data is directed simultaneously to two different locations.
I am looking for a complete C++ example using Boost tee to output to standard out and to a file like "sample.txt".
Here's an example using
tee_filter
I'm currently using to tee my Boost.Test output:Based on help from the question John linked: