This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/4419: ifstream::get(buffer,len) stops reading when an empty line appears.
- From: salvador <salvador at inti dot gov dot ar>
- To: paolo at gcc dot gnu dot org
- Cc: gcc-bugs at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, pavenis at lanet dot lv
- Date: Mon, 10 Dec 2001 09:44:05 -0300
- Subject: Re: libstdc++/4419: ifstream::get(buffer,len) stops reading when an empty line appears.
- Organization: INTI
- References: <20011208104247.31736.qmail@sources.redhat.com>
- Reply-to: salvador at inti dot gov dot ar
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