c++的streaming
来源:互联网 发布:数据泄露调查报告 编辑:程序博客网 时间:2024/04/28 21:53
#include <iostream>
#include <fstream>
int main()
{
std::ofstream logFile("out.txt");
std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
// do the actual work of the program;
// GUI code and event loop would go here
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";
// end of program body
// restore the buffers
std::cout.rdbuf(outbuf);
std::cerr.rdbuf(errbuf);
}
rdbuf函数返回一个由基类basic_ios管理的流缓冲区的指针。重载版本允许你替换流缓
冲区,返回值是原始的流缓冲区。
#include <fstream>
int main()
{
std::ofstream logFile("out.txt");
std::streambuf *outbuf = std::cout.rdbuf(logFile.rdbuf());
std::streambuf *errbuf = std::cerr.rdbuf(logFile.rdbuf());
// do the actual work of the program;
// GUI code and event loop would go here
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";
// end of program body
// restore the buffers
std::cout.rdbuf(outbuf);
std::cerr.rdbuf(errbuf);
}
rdbuf函数返回一个由基类basic_ios管理的流缓冲区的指针。重载版本允许你替换流缓
冲区,返回值是原始的流缓冲区。
- c++&&python实现Hadoop Streaming的partitioner和模块化
- Streaming(C++)实现WordCount
- c++的streaming
- Hadoop的Streaming学习
- Spark Streaming的WindowedDStream
- Hadoop Streaming的使用
- Streaming
- HTTP Streaming例子: AsfRecorder.c代码
- Hadoop Streaming python c c++ perl 编程
- Audio Streaming mit UDP in C
- audio streaming的项目总结
- Darwing Streaming Server的安装
- 免费的Silverlight Streaming存储空间
- p2p streaming的一点研究
- Darwing Streaming Server的安装
- streaming方式的CombineFileInputFormat实现
- Hadoop Streaming的一些基本知识
- Spark Streaming的窗口操作
- abstract类的定义及final的用法!
- 人生感悟第一篇章
- ODBC的多线程应用
- 全文检索
- 一个对c++的批评
- c++的streaming
- packet类的一些思路
- 播放器的。。。使用
- 配置adhoc
- 右键问题
- 첨으루 올라오네.ㅋㅋㅋ
- 硅谷的故事:关于硅谷的学术研究
- audio streaming的项目总结
- 高效可扩展的数据包设计