Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site oddjob.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!oddjob!matt From: matt@oddjob.UUCP (Matt Crawford) Newsgroups: net.lang.c Subject: Re: ugliness in scanf(3) Message-ID: <714@oddjob.UUCP> Date: Sat, 11-May-85 20:18:08 EDT Article-I.D.: oddjob.714 Posted: Sat May 11 20:18:08 1985 Date-Received: Sun, 12-May-85 06:08:21 EDT References: <10496@brl-tgr.ARPA> <190@mplvax.UUCP> <189@mplvax.UUCP> Reply-To: matt@oddjob.UUCP (Matt Crawford) Followup-To: net.flame Organization: U. Chicago, Astronomy & Astrophysics Lines: 42 In article <190@mplvax.UUCP> cdl@mplvax.UUCP (Carl Lowenstein) writes: >In article <10496@brl-tgr.ARPA> gwyn@Brl.ARPA (VLD/VMB) writes: >>If it ate the "failing" character, you could never see what it >>was. I think the routine was designed on the assumption that >>the programmer would not be so stupid as to keep trying to >>scan a chunk of input over & over with the same failing format. > >*mild flame* > >This programmer is so stupid as to expect to find the behavior >of scanf documented in the manual. > >*unflame* > carl lowenstein marine physical lab u.c. san diego THIS programmer is not too arrogant to open the manual before telling someone what's not in it: SCANF(3S) UNIX Programmer's Manual SCANF(3S) For example, ..... int i; float x; char name[50]; scanf("%2d%f%*d%[1234567890]", &i, &x, name); with input 56789 0123 56a72 will assign 56 to i, 789.0 to x, skip `0123', and place the string `56\0' in name. The next call to getchar will return `a'. ------------------------------------ ---- If you make a mistake you can (a) admit it, (b) shut up, or (c) prolong the argument and provide more entertainment. I will choose course (a) and admit that I am making a mistake by posting anything at all on this subject. _____________________________________________________ Matt University crawford@anl-mcs.arpa Crawford of Chicago ihnp4!oddjob!matt