istrstream::rdbuf 用法:
strstreambuf *rdbuf( ) const
Return Value
A pointer to the stream's associated strstreambuf object.
rdbuf的作用是输出整个文件内容:
如:
//clib.cpp
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ifstream in("clib.cpp");
cout<<in.rdbuf();
}
输出结果是:
//clib.cpp
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ifstream in("clib.cpp");
cout<<in.rdbuf();
}
strstreambuf *rdbuf( ) const
Return Value
A pointer to the stream's associated strstreambuf object.
rdbuf的作用是输出整个文件内容:
如:
//clib.cpp
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ifstream in("clib.cpp");
cout<<in.rdbuf();
}
输出结果是:
//clib.cpp
#include<iostream>
#include<fstream>
using namespace std;
int main(){
ifstream in("clib.cpp");
cout<<in.rdbuf();
}