making stringstream empty

M

mthread

Hi,
I am using a variable of type stringstream in my application. I
am adding some information in the stream. I would like to know what is
the method to make the stream empty. Thanx in advance.
 
Ê

ʱ³½Î°

Hi,
I am using a variable of type stringstream in my application. I
am adding some information in the stream. I would like to know what is
the method to make the stream empty. Thanx in advance.

you can use clear() method to make the stream empty.
 
K

kasthurirangan.balaji

Hi,
     I am using a variable of type stringstream in my application. I
am adding some information in the stream. I would like to know what is
the method to make the stream empty. Thanx in advance.

use str member function.

#include <sstream>

main()
{
std::stringstream sstr;
sstr << "hello";
sstr.str("");
}

Thanks,
Balaji.
 
J

Joe Greer

you can use clear() method to make the stream empty.

It sure sounds like that's what it should do, doesn't it? Too bad it
really only clears some flags. str("") is the way to reset the string.
 
J

Jeff Schwab

mthread said:
Hi,
I am using a variable of type stringstream in my application. I
am adding some information in the stream. I would like to know what is
the method to make the stream empty. Thanx in advance.

ss.str(std::string());
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,086
Latest member
ChelseaAmi

Latest Threads

Top