1)我想将信息从一个字符串流发送到另外几个字符串流。但是在下面的例子中,似乎在<< in_contents.rdbuf(); ,in_contests为空。我应该使用什么操作才能避免它?
2)为什么在上述操作之后 in_contents 中没有设置 eofbit 和 failbit ,如 std :: getline(in_contents,word)?我已经移动了整个缓冲区,但是......
谢谢!
std::stringstream in_contents("gg");
std::stringstream out_contents1;
std::stringstream out_contents2;
out_contents1 << in_contents.rdbuf(); //make in_contents buffer empty?
in_contents.seekg(0);
out_contents2 << in_contents.rdbuf();//out_contents2 has nothing
cout << endl << in_contents.eof();//zero?
cout << endl << in_contents.fail();//zero?
//std::getline(in_contents, word);//failbit=1; eofbit=1?