I
Immortal Nephi
I write the information into string stream buffer before cout prints
it to the screen. I would like to reuse the same buffer before I put
new information in it. How do I flush or erase the buffer? The
rdbuf() function is not necessary and where can I use different
function?
std::stringstream ss;
ss << "Hello";
ss << " World!";
std::cout << ss.str() << std::endl;
ss.rdbuf()->str( "" ); // Erase buffer
ss << "Moon";
std::cout << ss.str() << std::endl;
it to the screen. I would like to reuse the same buffer before I put
new information in it. How do I flush or erase the buffer? The
rdbuf() function is not necessary and where can I use different
function?
std::stringstream ss;
ss << "Hello";
ss << " World!";
std::cout << ss.str() << std::endl;
ss.rdbuf()->str( "" ); // Erase buffer
ss << "Moon";
std::cout << ss.str() << std::endl;