65,211
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<sstream>
using namespace std;
main()
{
ostringstream os("This is a test.");
cout << os.rdbuf();//改成cout << os.str()可以,但为什么rdbuf()不行?
system("pause");
}
#include<iostream>
#include<sstream>
using namespace std;
main()
{
istringstream os("This is a test.");//
cout << os.rdbuf();
system("pause");
}
#include<sstream>
#include<iostream>
int main()
{
ostringstream os("This is a test.",ios::in);
cout << os.rdbuf();
system("pause");
}
cout读取的是输入流,输入流要有东西才可以输出东东!