Topic: String Streams


Author: Dietmar Kuehl <dietmar.kuehl@claas-solutions.de>
Date: 2000/02/24
Raw View
Hi,
In article <MPG.131aaad04385bc549897ac@news.mindspring.com>,
  Dave Hardenbrook <DaveH47@mindspring.com> wrote:
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?

Both headers are in the C++ standard library. However, the header
<strstream> is deprecated and you should prefer the classes from the
header <sstream> in new software: These classes are much less error
prone than the classes from the other header. Also, the string stream
classes from <sstream> work with arbitrary character types while those
from <strstream> only work for 'char'.

BTW, the C++ is not only an ANSI standard, it is an ISO standard.
--
<mailto:dietmar.kuehl@claas-solutions.de>
homepage: <http://www.informatik.uni-konstanz.de/~kuehl>


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: James Kuyper <kuyper@wizard.net>
Date: 2000/02/24
Raw View
Dave Hardenbrook wrote:
>
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?

There's a simple reason. <strstream> is deprecated (Appendix D.7), while
<sstream> (section 27.7) is the replacement. If you've got legacy code
which uses <strstream>, you've got a bit of conversion to do if you want
it to be up-to-date. Have fun!

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Tom Payne <thp@roam-thp2.cs.ucr.edu>
Date: 2000/02/24
Raw View
Dave Hardenbrook <DaveH47@mindspring.com> wrote:
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?
> --

The libraries that came with my redhat

  /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
  gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)

seem to include <strstream> but not <sstream>.  Is that normal?

Tom Payne

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Dietmar Kuehl <dietmar.kuehl@claas-solutions.de>
Date: 2000/02/25
Raw View
Hi,
In article <891p6k$g3k$1@pravda.ucr.edu>,
  Tom Payne <thp@roam-thp2.cs.ucr.edu> wrote:
> The libraries that came with my redhat
>
>   /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
>   gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
>
> seem to include <strstream> but not <sstream>.  Is that normal?

The library currently shipping with gcc does not yet address standard
conformance very well. In particular, the IOStreams in this library
are not yet updated to use the standard interface. There is currently
a rewrite of this library in progress (see
<http://sourceware.cygnus.com/libstdc++/>) but it is apparently not yet
done.

Until this library gets released, you can augment your current library
with the stuff found at
<ftp://ftp.fmi.uni-konstanz.de/pub/algo/personal/kuehl/sstream-egcs.tgz>
to add typically needed stuff from the header <sstream> to the current
library. This extends the existing library. You might also want to try
one of the other implementations of the standard C++ library, eg. the
SGI Implementation (<http://www.sgi.com/Technology/STL/>) probably in
the form of STLPort (sorry, I don't have an URL for this handy, or my
implementation (<http://www.claas-solutions.de/cxxrt/>).
--
<mailto:dietmar.kuehl@claas-solutions.de>
homepage: <http://www.informatik.uni-konstanz.de/~kuehl>


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Dave Hardenbrook <DaveH47@mindspring.com>
Date: 2000/02/22
Raw View
I'm getting conflicting info: Which is the correct header for ANSI
compliant String streams, <sstream> or <strstream>?
--

                              -- Dave

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: sirwillard@my-deja.com
Date: 2000/02/22
Raw View
In article <MPG.131aaad04385bc549897ac@news.mindspring.com>,
  Dave Hardenbrook <DaveH47@mindspring.com> wrote:
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?

That depends.  Do you want strstream (uses char* buffers) or
stringstream (or more precisely std::basic_stringstream, which uses
std::string).  <sstream> for stringstream, <strstream> for strstream.

--
William E. Kempf
Software Engineer, MS Windows Programmer


Sent via Deja.com http://www.deja.com/
Before you buy.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Jeremy Jancsary <jancsary@gmx.net>
Date: 2000/02/22
Raw View

Dave Hardenbrook wrote:
>
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?

<sstream>.

--
Regards,

Jeremy M. Jancsary
jancsary@gmx.net

/***************************Quote of the Day************************
*                                                                  *
*  I count him braver who overcomes his desires than him who       *
*  overcomes his enemies, for the hardest victory is the victory   *
*  over self.                                                      *
*                                                                  *
*                                                    -- Aristotle  *
*                                                   (Floritegium)  *
*                                                                  *
*******************************************************************/

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: Jerry Coffin <jcoffin@taeus.com>
Date: 2000/02/23
Raw View
In article <MPG.131aaad04385bc549897ac@news.mindspring.com>, DaveH47
@mindspring.com says...
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?

Both -- the primary one to use is sstream, but strstream is still
included for backward compatibility.  If you have existing code that
uses strstream, rewriting it probably shouldn't be your top priority,
but if you're writing new code, you probably want to sstream instead.

--
    Later,
    Jerry.

The universe is a figment of its own imagination.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]






Author: "Barry Wallis" <me@mine.com>
Date: 2000/02/24
Raw View
"Dave Hardenbrook" <DaveH47@mindspring.com> wrote in message
news:MPG.131aaad04385bc549897ac@news.mindspring.com...
> I'm getting conflicting info: Which is the correct header for ANSI
> compliant String streams, <sstream> or <strstream>?

<sstream>


--


Barry L. Wallis, Senior Systems Engineer
Science Applications International Corporation
4161 Campus Point Court
San Diego, CA 92121
  _____
"In all labor there is profit, but mere talk leads to poverty."
- King Solomon

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]