51 const std::string& out_file,
bool also_to_console =
true,
52 bool also_cerr =
true,
bool append_file =
false,
int bufferSize = 1000)
60 std::ios_base::openmode openMode =
61 std::ios_base::binary | std::ios_base::out;
62 if (append_file) openMode |= std::ios_base::app;
63 m_of.open(out_file.c_str(), openMode);
69 char* ptr =
new char[bufferSize];
70 setp(ptr, ptr + bufferSize);
76 sbOld = std::cout.rdbuf();
77 std::cout.rdbuf(
this);
82 std::cerr.rdbuf(
this);
90 std::cout.rdbuf(
sbOld);
92 if (pbase())
delete[] pbase();
110 if (pbase() == epptr())
127 if (pbase() != pptr())
129 int len = int(pptr() - pbase());
132 setp(pbase(), epptr());