redirect stdout to file
More...
#include <dx_redirect.h>
|
| | file (std::ostream &ostream, const char *file, std::ofstream::openmode openmode=std::ios::app) |
| | ~file () |
redirect stdout to file
Multiple file instances can target the same ostream (e.g. std::clog) concurrently and outlive each other in any order - construction/destruction here is not required to nest LIFO, unlike redirect::indent. Each instance's rdbuf install/ restore is therefore tracked on a shared, mutex-guarded stack per ostream rather than each instance blindly capturing and restoring "whatever was there before
me": naively doing that lets an instance destructed after some other, unrelated instance restore a now-dangling streambuf pointer that other instance owned.
◆ file()
| dx::redirect::file::file |
( |
std::ostream & | ostream, |
|
|
const char * | file, |
|
|
std::ofstream::openmode | openmode = std::ios::app ) |
|
inline |
◆ ~file()
| dx::redirect::file::~file |
( |
| ) |
|
|
inline |
The documentation for this class was generated from the following file: