C++ 文件写入

#include <iostream>
#include <fstream>
using namespace std;

ofstream file( "rdbuf.txt" );
streambuf *x = cout.rdbuf( file.rdbuf( ) );
cout << "test" << endl;   
cout << "test2" << endl;
cout.rdbuf(x);

posted @ 2014-01-02 15:28  00000000O  阅读(182)  评论(0)    收藏  举报