From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3206 invoked by alias); 12 May 2009 04:02:36 -0000 Received: (qmail 2921 invoked by uid 22791); 12 May 2009 04:02:34 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_20,J_CHICKENPOX_14,J_CHICKENPOX_43,SPF_PASS X-Spam-Check-By: sourceware.org Received: from web84007.mail.mud.yahoo.com (HELO web84007.mail.mud.yahoo.com) (68.142.206.177) by sourceware.org (qpsmtpd/0.43rc1) with SMTP; Tue, 12 May 2009 04:02:29 +0000 Received: (qmail 73895 invoked by uid 60001); 12 May 2009 04:02:27 -0000 Message-ID: <344634.73119.qm@web84007.mail.mud.yahoo.com> Received: from [96.248.235.233] by web84007.mail.mud.yahoo.com via HTTP; Mon, 11 May 2009 21:02:27 PDT Date: Tue, 12 May 2009 06:33:00 -0000 From: Arthur Schwarz Subject: cout Issue To: gcc@gcc.gnu.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-05/txt/msg00287.txt.bz2 Program and particulars below. When line 27 is commented out, line 26 is output. When line 27 is not commented, line 26 is not output except that if x.file contains a line feed the null line line 26 & line 27 are output. If x.file does not contain a line feed, only line 27 is output. Does the line feed have an effect on the 'cout <<' of line 26 of the program? Note. The code is awful and this is an example. art g++-4 (GCC) 4.3.2 20080827 (beta) 2 x.cpp 1 # include 2 # include 3 # include 4 # include 5 # include 6 7 using namespace std; 8 9 ifstream x("x.file", ios::in); 10 11 struct y { 12 double a; 13 double b; 14 } yNot; 15 16 int main(int argc, char** argv) { 17 char Line[512]; 18 long LineNo = 0; 19 while ( !x.eof() ) { 20 LineNo++; 21 x.getline(Line, 512); 22 istringstream Phfft(Line); 23 yNot.a = -1; 24 yNot.b = -2; 25 Phfft >> yNot.a >> yNot.b; 26 cout << setw(4) << LineNo << ": " << Line; 27 cout << " a:" << yNot.a << " b:" << yNot.b; 28 cout << endl; 29 } 30 return 0; 31 } x.file 1 2