This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: <strstream> vs <sstream>
- From: Phil Edwards <phil at jaj dot com>
- To: imarkov at eecs dot umich dot edu
- Cc: Paolo Carlini <pcarlini at unitus dot it>, gcc <gcc at gnu dot org>, gcc-help at gnu dot org
- Date: Sat, 31 Aug 2002 16:06:13 -0400
- Subject: Re: <strstream> vs <sstream>
- References: <1030790905.3d709ef955786@www.eecs.umich.edu> <3D70A4AF.5030103@unitus.it> <1030820437.3d711255ea66d@www.eecs.umich.edu>
On Sat, Aug 31, 2002 at 03:00:37PM -0400, Igor Markov wrote:
> thanks for the equivalent code,
> but it does not seem to compile either
>
> /n/gagarin/z/imarkov/devel/ g++ testS.cxx
> testS.cxx: In function `int main()':
> testS.cxx:5: `ostrstream' undeclared in namespace `std'
> testS.cxx:5: parse error before `(' token
> /n/gagarin/z/imarkov/devel/ g++ --version
> g++ (GCC) 3.2 20020809 (Debian prerelease)
> Copyright (C) 2002 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions. There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
> /n/gagarin/z/imarkov/devel/ cat testS.cxx
>
> #include <sstream>
>
> //int main() { char buf[10]; std::osstream s(buf,10); }
> int main() { std::string buf; std::ostrstream s(buf); }
- *strstream classes are declared in <strstream>
- *stringstream classes are declared in <sstream>
- If you want to use both classes you must include both headers
- *strstream classes are deprecated, stop using them and move to *stringstream
As Paolo said, a good book would be the best help here.
Phil
--
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
- Edsger Dijkstra, 1930-2002