#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
int main ()
{
ifstream mf;
filebuf *pbuf;
char *strbuf;
mf.open("./test.txt");
pbuf = mf.rdbuf();
long len = pbuf->pubseekoff(0, ios::end, ios::in);
cout << "len: " << len << endl;
pbuf->pubseekpos(0, ios::in);
strbuf = new char[len];
pbuf->sgetn(strbuf, len);
string str(strbuf);
cout << "str: " << str << endl;
istringstream istr(str, istringstream::in);
cout << "istr: " << istr.str() << endl;
delete strbuf;
mf.close();
return 0;
}