Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!rlgvax!hadron!jsdy From: jsdy@hadron.UUCP (Joseph S. D. Yao) Newsgroups: net.lang.c Subject: Re: mixing scanf and gets Message-ID: <369@hadron.UUCP> Date: Thu, 10-Apr-86 00:40:07 EST Article-I.D.: hadron.369 Posted: Thu Apr 10 00:40:07 1986 Date-Received: Sat, 12-Apr-86 22:16:36 EST References: <2476@brl-smoke.ARPA> Reply-To: jsdy@hadron.UUCP (Joseph S. D. Yao) Organization: Hadron, Inc., Fairfax, VA Lines: 14 Summary: Never use gets()/fgets() for binary. Use fread(). In article <2476@brl-smoke.ARPA> rbj@icst-cmr (Root Boy Jim) writes: >Which brings me to another point. Fgets is worthless on binary >data. It returns its first argument, which I already know. > ... I would like fgets to return the number of chars read. T h a t is what fread() is for. Use it. Having an element-size and a number-of-elements is useful when doing, e.g., structure I/O, otherwise it is a bit of a pain, I'll agree. [BTW, we have some decent pinball machines down at this end of Montgomery County, tho I can't recall seeing Big Injun.] -- Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP}