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>


   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


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