boost-iostreams

C++ “hello world” Boost tee example program

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 16:45:55
问题 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". 回答1: Based on help from the question John linked: #include <boost/iostreams/tee.hpp> #include <boost/iostreams/stream.hpp> #include <fstream> #include <iostream> using std