现在的位置: 首页 > 综合 > 正文

C++高效编程:内存与性能优化

2012年07月05日 ⁄ 综合 ⁄ 共 260字 ⁄ 字号 评论关闭

 

   1: #include <iostream>

   2: #include <fstream>

   3: using namespace std;    

   4:  

   5: int main(){

   6: ofstream out;

   7: out.open("i://t.txt",ios::app);

   8: streambuf *backup = clog.rdbuf();

   9: clog.rdbuf(out.rdbuf());

  10: clog<<"my log..."<<endl;

  11: out.close();

  12: clog.rdbuf(backup);//必须重定向回来

  13:  

  14: }

抱歉!评论已关闭.