[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: getF in lauxlib.c--why call feof?
- From: Thomas Harning <harningt@...>
- Date: Tue, 25 Mar 2008 13:52:22 -0400
On Tue, 25 Mar 2008 14:38:47 -0300
Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> > Why is it necessary to call feof before the fread? Won't fread
> > return 0 if feof returns true? It seems that fread correctly
> > handles the case of EOF.
>
> The man page says:
>
> fread does not distinguish between end-of-file and error, and
> callers must use feof(3) and ferror(3) to determine which occurred.
>
Wouldn't that mean that you should call feof/ferror to determine the
error after the fact?