libstdc++/4419: ifstream::get(buffer,len) stops reading when an empty line appears.

salvador salvador@inti.gov.ar
Mon Dec 10 04:46:00 GMT 2001


The following reply was made to PR libstdc++/4419; it has been noted by GNATS.

From: salvador <salvador@inti.gov.ar>
To: paolo@gcc.gnu.org
Cc: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org,
 	gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org,  pavenis@lanet.lv
Subject: Re: libstdc++/4419: ifstream::get(buffer,len) stops reading when an 
 empty line appears.
Date: Mon, 10 Dec 2001 09:44:05 -0300

 paolo@gcc.gnu.org wrote:
 
 > Synopsis: ifstream::get(buffer,len) stops reading when an empty line appears.
 >
 > Responsible-Changed-From-To: unassigned->paolo
 > Responsible-Changed-By: paolo
 > Responsible-Changed-When: Sat Dec  8 02:42:46 2001
 > Responsible-Changed-Why:
 >     Looking into it.
 > State-Changed-From-To: open->feedback
 > State-Changed-By: paolo
 > State-Changed-When: Sat Dec  8 02:42:46 2001
 > State-Changed-Why:
 >     Why don't you use something like:
 >
 >       while(!fileToView.eof())
 >         {
 >           fileToView.getline(line, sizeof line);
 >           printf("%d\n",strlen(line));
 >         }
 >
 >     ???
 
 That's more or less what I'm doing now. But the problem is that I was porting all
 code that used the other way and was working for years.
 As this code is an example of a library I'm affraid a lot of people will be using the
 old approach and failing.
 I got really confused when the code break without any apparent reason.
 
 SET
 
 BTW: What I use now is a macro, it expands to getline for gcc (libstdc++ v2 and v3)
 but I was forced to expand it to a function call for Borland compilers where the
 getline fails to extract the trailing newline.
 
 --
 Salvador Eduardo Tropea (SET). (Electronics Engineer)
 Visit my home page: http://welcome.to/SetSoft or
 http://www.geocities.com/SiliconValley/Vista/6552/
 Alternative e-mail: set@computer.org set@ieee.org
 Address: Curapaligue 2124, Caseros, 3 de Febrero
 Buenos Aires, (1678), ARGENTINA Phone: +(5411) 4759 0013
 
 
 



More information about the Gcc-prs mailing list