[C++] 一直忘記的 rdbuf()
從 M$ 上找到的範例,要記得啊~~~
// basic_ios_rdbuf.cpp
// compile with: /EHsc
#include <ios>
#include <iostream>
#include <fstream>
int main( )
{
using namespace std;
ofstream file( "rdbuf.txt" );
streambuf *x = cout.rdbuf( file.rdbuf( ) );
cout < < "test" << endl; // Goes to file
cout.rdbuf(x);
cout << "test2" << endl;
}
十一月 7th, 2005 | Category: General, Programming
| Subscribe to comments | Leave a comment | Trackback URL
| Visited (2/3397) times