libstdc++/4419: ifstream::get(buffer,len) stops reading when an empty line appears.
salvador
salvador@inti.gov.ar
Mon Dec 10 08:07:00 GMT 2001
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-bugs
mailing list