[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: getF in lauxlib.c--why call feof?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 26 Mar 2008 15:33:40 -0300
> /* EOF flag checked here because when lf->f is a terminal, the fread
> may return > 0 even when it is set. If you call fread again and
> lf->f is a terminal it will wait for the next line or CTRL-D. */
Actually I think the exact problem is a little different: fread can
return > 0 *and* set the EOF flag. The next time getF is called, if
you call fread, then the terminal will wait for user input. By calling
feof before fread, you avoid this wait.