From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23804 invoked by alias); 25 Oct 2002 17:15:33 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 23757 invoked from network); 25 Oct 2002 17:15:32 -0000 Received: from unknown (HELO bclcl1.im.battelle.org) (131.167.1.2) by sources.redhat.com with SMTP; 25 Oct 2002 17:15:32 -0000 Received: from ns-bco-scn1.im.battelle.org ([131.167.1.122]) by BCLCL1 (PMDF V5.1-10 #U2779) with SMTP id <01KO309K0J4S95R79O@BCLCL1> for gcc-help@gcc.gnu.org; Fri, 25 Oct 2002 13:15:39 EDT Received: from 131.167.1.91 by ns-bco-scn1.im.battelle.org (InterScan E-Mail VirusWall NT); Fri, 25 Oct 2002 13:15:26 -0400 Received: by ws-bco-mse1.milky-way.battelle.org with Internet Mail Service (5.5.2655.55) id ; Fri, 25 Oct 2002 13:15:26 -0400 Date: Fri, 25 Oct 2002 10:15:00 -0000 From: "Moore, Mathew L" Subject: RE: Problems with stringstream To: "'Jessee, Mark'" , "'gcc-help@gcc.gnu.org'" Cc: 'bjorn rohde jensen' Message-id: <2F05A390F72A0A409390E016D23E45E8042DBED5@ns-bco-mse4.im.battelle.org> MIME-version: 1.0 Content-type: text/plain; charset="iso-8859-1" X-SW-Source: 2002-10/txt/msg00327.txt.bz2 std::endl will flush the buffer (after adding a new line). If you don't want to add the newline then you can just flush() it: cout << mystr; cout.flush(); Do you need to add the extra strings as well, or does just the flush() work for you? I thought that the streams were automatically flushed when they reached the end of their scope (at the end of your main function here). Anybody know if that is incorrect? --Matt > -----Original Message----- > From: Jessee, Mark [mailto:Mark.Jessee@gdcanada.com] > Sent: Friday, October 25, 2002 12:48 > To: 'Moore, Mathew L'; Jessee, Mark; 'gcc-help@gcc.gnu.org' > Subject: 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 > #include > #include > 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 > > >