thanks for "down" answers
Doug Gwyn
gwyn at smoke.BRL.MIL
Sat Dec 17 17:11:20 AEST 1988
In article <411 at aber-cs.UUCP> pcg at cs.aber.ac.uk (Piercarlo Grandi) writes:
>Admittedly, the ice is not thick here (pun on K&R :->). If one wants absolute
>safety in reading *bytes* (not characters), one must use fread(3) (ugh!).
But fread() is defined in terms of getc(). getc() and getchar() are
required to read any value, not just those corresponding to meaningful
characters of the local character set. There IS a possible mapping
when reading text files, in order to accommodate various line delimiter
conventions, but that applies to all the functions including fread().
Binary streams have no such mapping, and getc() on them is perfectly
safe.
More information about the Comp.lang.c
mailing list