Hi

cout in the code below stops outputting anything after I copy buffer from empty sstringstream to it.
I dont quite understand why it happens.
I'll appreciate if you could help explain this.


Is there a better way to check stringstream before using rdbuf?
I was going to try if(ss.tellp() != ios::beg) but it caused compiled time error.

Code:
#include<iostream>
#include<string>
#include<sstream>
using namespace std;

int main()
{
	stringstream ss;

	cout << ss.rdbuf();
	string s = "abcdefg";
	cout << s; // nothing comes out on screen.
	cout << "123"; // nothing.
		
}

Regards,
Sam