* Re: <strstream> vs <sstream>
[not found] ` <3D70A4AF.5030103@unitus.it>
@ 2002-08-31 12:53 ` Igor Markov
2002-08-31 13:06 ` Phil Edwards
0 siblings, 1 reply; 2+ messages in thread
From: Igor Markov @ 2002-08-31 12:53 UTC (permalink / raw)
To: Paolo Carlini; +Cc: imarkov, gcc, gcc-help
Paolo,
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); }
/n/gagarin/z/imarkov/devel/
Igor
Quoting Paolo Carlini <pcarlini@unitus.it>:
> Igor Markov wrote:
>
> > g++ 3.1.1 and 3.2 ( which I am using on Debian Linux) complain about
> >#include <strstream>
> > and I am having trouble with the suggested replacement
> >#include <sstream>
> >
> The <sstream> equivalent is, roughly:
>
> #include <sstream>
> int main() { std::string buf; std::ostrstream s(buf); }
>
> I suggest perusing §13.11 of Josuttis (ISBN: 0201379260).
>
> Ciao, Paolo.
>
> P.S. Strictly speaking, this list is "... for general development
> discussions...": gcc-help is more appropriate for this kind of questions.
>
>
>
--
Igor Markov (734) 936-7829 EECS 2211
http://www.eecs.umich.edu/~imarkov
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: <strstream> vs <sstream>
2002-08-31 12:53 ` <strstream> vs <sstream> Igor Markov
@ 2002-08-31 13:06 ` Phil Edwards
0 siblings, 0 replies; 2+ messages in thread
From: Phil Edwards @ 2002-08-31 13:06 UTC (permalink / raw)
To: imarkov; +Cc: Paolo Carlini, gcc, gcc-help
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-08-31 20:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1030790905.3d709ef955786@www.eecs.umich.edu>
[not found] ` <3D70A4AF.5030103@unitus.it>
2002-08-31 12:53 ` <strstream> vs <sstream> Igor Markov
2002-08-31 13:06 ` Phil Edwards
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).