怎样把输出绑定到一个CString中去
cout,cerr的重定向输出一般都定向到文件中去了,如下面的代码:
std::ofstream logFile("out.txt");
std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
std::cout << "This would normally go to cout but goes to the log file\n";
std::cerr << "This would normally go to cerr but goes to the log file \n";
logFile << "This goes to the log file\n";
std::cout.rdbuf(outbuf);
std::cerr.rdbuf(errbuf);
我现在希望不要放到文件中去,而是用一个CString或者Char*来存储,该怎么做,求高手指点