[英]Redirecting std::fstream to output to std::cout stream
How to redirect std::fstream object to output to standart output stream?如何将 std::fstream 对象重定向到输出到标准输出流? So I could use my object instead of std::cout.
所以我可以使用我的对象而不是 std::cout。
fs.std::ios::rdbuf(std::cout.rdbuf())
would make fs
use the same underlying stream buffer as std::cout
. fs.std::ios::rdbuf(std::cout.rdbuf())
将使fs
使用与std::cout
相同的底层流缓冲区。
I wouldn't recommend it, though.不过,我不会推荐它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.