[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: io:lines() and \0
- From: Roberto Ierusalimschy <roberto@...>
- Date: Thu, 20 Feb 2014 15:22:27 -0300
> In case I did not explain myself. No production libC I've ever looked
> at does fgets with a getc loop, I knew this. But all the ones I
> remember using give the same result ( as chars stored in the buffer,
> not counting buffer overflows, EOF checking and the errors I'm sure
> to introduce now ) for 'fgets(buf, size, file)' and
> 'while((c=getc(f)!='\n' && c!=EOF) *buf++=c; *buf=0;', and that is
> what I meant for equivalent.
ANSI C explicitly demands that:
7.19.3 Files
11. [...] The byte input functions read characters from the stream as if
by successive calls to the fgetc function.
-- Roberto
- References:
- Re: io:lines() and \0, Craig Barnes
- Re: io:lines() and \0, Sean Conner
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, René Rebe
- Re: io:lines() and \0, Sean Conner
- Re: io:lines() and \0, Francisco Olarte
- Re: io:lines() and \0, Enrico Colombini
- Re: io:lines() and \0, Francisco Olarte
- Re: io:lines() and \0, Luiz Henrique de Figueiredo
- Re: io:lines() and \0, Francisco Olarte