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

 

   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: }
posted on 2011-10-06 00:01  yangyh  阅读(1289)  评论(0编辑  收藏  举报