This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: <strstream> vs <sstream>


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]