Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C++ Programming

Need reference for stringstream


I am trying to use stringstreams and my book doesn't cover the included
methods. For example, if I init a istringstream on a string and suck all
the data out, then put more stuff into the string, how do I reset the
ISS to see the new data? Does this make sense?
On May 28, 8:30 pm, clb <c@earthlink.net> wrote:

> I am trying to use stringstreams and my book doesn't cover the included
> methods. For example, if I init a istringstream on a string and suck all
> the data out, then put more stuff into the string, how do I reset the
> ISS to see the new data? Does this make sense?

You can start with the Apapche C++ Standard Library online
documentation,
the chapter on string streams in the User's Guide:
http://incubator.apache.org/stdcxx/doc/stdlibug/31.html
On 29 Maj, 04:30, clb <c@earthlink.net> wrote:

> I am trying to use stringstreams and my book doesn't cover the included
> methods. For example, if I init a istringstream on a string and suck all
> the data out, then put more stuff into the string, how do I reset the
> ISS to see the new data? Does this make sense?

You have to put the new content into the stringstream, depending on
your needs it might be as simple as to use the << operator to output
the string to the stringstream. Notice that the string you specified
in the ctor is not used as buffer for the stringstream, only
initialization. Check this site out for more information:
http://www.cplusplus.com/reference/iostream/stringstream/stringstream...

--
Erik Wikstrm

clb <c@earthlink.net> wrote in message

news:465B9044.950A273C@earthlink.net...

> I am trying to use stringstreams and my book doesn't cover the included
> methods. For example, if I init a istringstream on a string and suck all
> the data out, then put more stuff into the string, how do I reset the
> ISS to see the new data? Does this make sense?

First, use 'MySs.clear();' to reset any 'fail flags' on the stream.
Then you can empty the stream by doing:
   MySs.str("");

... or, re-use it:
   MySs.str("Hello world!");

Actually, you don't 'suck all the data out'. Try an experiment; set your
istringstream, 'suck all the data out', then try:
   MySs.clear();
   MySs.seekg(0); // assumes an std::[i]stringstream
.... then try 'reading' it again.
What happens?

[ correctios, as always, are welcome. ]
--
Bob R
POVrookie

Erik Wikstrm  wrote in message...

/* """
On 29 Maj, 04:30, clb <c@earthlink.net> wrote:

> I am trying to use stringstreams and my book doesn't cover the included
> methods. For example, if I init a istringstream on a string and suck all
> the data out, then put more stuff into the string, how do I reset the
> ISS to see the new data? Does this make sense?

You have to put the new content into the stringstream, depending on
your needs it might be as simple as to use the << operator to output
the string to the stringstream. Notice that the string you specified
in the ctor is not used as buffer for the stringstream, only
initialization. Check this site out for more information:
http://www.cplusplus.com/reference/iostream/stringstream/stringstream...
-  - Erik Wikstrm
""" */

Hi Erik,

<cough><choke> a '<<' on an std::istringstream'? <G>
(the OP mentioned 'istringstream', so thought I'd poke a little fun.)

Actually, I'm only (re)posting to mention to the OP that Dinkumware has some
documentation too. [ I forgot to put that in my other post]

--
Bob R
POVrookie

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc