lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> 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.