lua-users home
lua-l archive

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

> 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