This is the mail archive of the gcc-help@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: Problems with stringstream


Matt,

Your example fails as well.  But I found if I modify it a bit (see below),
it works fine.  Still not sure why though.  Thoughts?  Something to do with
flushing the stream?

#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main ()
{
   stringstream oss;
   string mystr;

   oss << "Sample string";
   mystr=oss.str();

   cout << "get ready..." << endl;
   cout << mystr;
   cout << "all done" << endl;

   return 0;
}

-----Original Message-----
From: Moore, Mathew L [mailto:MooreML@BATTELLE.ORG]
Sent: Friday, October 25, 2002 10:44 AM
To: 'Jessee, Mark'; 'gcc-help@gcc.gnu.org'
Subject: RE: Problems with stringstream


I wonder if this problem can be narrowed down?  Does it take this exact code
listing to reproduce the problem?  Can you just print out a string?

	string mystr("test");
	cout << mystr;

If your debugger produces the correct result, it would at least seem that
the stringstream portion is working correctly.  I wonder if your stdout was
remapped somewhere (is that possible?).

--Matt



> -----Original Message-----
> From: Jessee, Mark [mailto:Mark.Jessee@gdcanada.com]
> Sent: Friday, October 25, 2002 12:30
> To: 'gcc-help@gcc.gnu.org'
> Cc: 'John Love-Jensen'
> Subject: RE: Problems with stringstream
> 
> 
> I'm running it on Mandrake Linux.  When I run it from the 
> command line - no
> output.  However when I run it from the ddd debugger, it 
> works fine!  Huh?!?
> 
> -----Original Message-----
> From: John Love-Jensen [mailto:eljay@adobe.com]
> Sent: Friday, October 25, 2002 10:22 AM
> To: Jessee, Mark
> Subject: Re: Problems with stringstream
> 
> 
> Using GCC 3.2 on Cygwin, your example worked perfectly as one 
> would expect.
> 
> Hmmm.
> 
> --Eljay
> 


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