|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 2ÔÂ21ÈÕ, ÏÂÎç5ʱ20·Ö, mthread <rjk...@gmail.com> wrote:
> 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. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Feb 21, 2:20pm, mthread <rjk...@gmail.com> wrote:
> 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. |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
In message
<ccaa3c01-7313-4ed0-8b4b-34afc582ba26@t66g2000hsf.googlegroups.com>, =?GB2312?B?yrGzvc6w?= <shichenweixjtu@gmail.com> writes >On 2ÔÂ21ÈÕ, ÏÂÎç5ʱ20·Ö, mthread <rjk...@gmail.com> wrote: >> 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. No, you can't. clear() clears the iostate flags. str("") makes it empty. -- Richard Herring |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
"=?GB2312?B?yrGzvc6w?=" <shichenweixjtu@gmail.com> wrote in news:ccaa3c01-
7313-4ed0-8b4b-34afc582ba26@t66g2000...oglegroups.com: > On 2ÔÂ21ÈÕ, ÏÂÎç5ʱ20·Ö, mthread <rjk...@gmail.com> wrote: >> 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. 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. |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
mthread wrote:
> 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()); |
|
![]() |
| Outils de la discussion | |
|
|