Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!cmcl2!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: thanks for "down" answers Message-ID: <9220@smoke.BRL.MIL> Date: 17 Dec 88 07:11:20 GMT References: <9142@smoke.BRL.MIL> <685@auspex.UUCP> <411@aber-cs.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 11 In article <411@aber-cs.UUCP> pcg@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.