From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3635 invoked by alias); 10 Dec 2001 12:46:06 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3612 invoked by uid 71); 10 Dec 2001 12:46:03 -0000 Date: Mon, 10 Dec 2001 04:46:00 -0000 Message-ID: <20011210124603.3611.qmail@sources.redhat.com> To: paolo@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: salvador Subject: Re: libstdc++/4419: ifstream::get(buffer,len) stops reading when an empty line appears. Reply-To: salvador X-SW-Source: 2001-12/txt/msg00566.txt.bz2 List-Id: The following reply was made to PR libstdc++/4419; it has been noted by GNATS. From: salvador 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