Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ihnp4!qantel!lll-lcc!lll-crg!rutgers!topaz!ll-xn!mit-amt!mit-eddie!genrad!decvax!ucbvax!hplabs!sdcrdcf!trwrb!orion!vaughan From: vaughan@orion.UUCP (Robert Vaughan) Newsgroups: net.lang.c Subject: Re: Using SCANF with DOUBLE precision variables... Message-ID: <22@orion.UUCP> Date: Thu, 25-Sep-86 17:57:14 EDT Article-I.D.: orion.22 Posted: Thu Sep 25 17:57:14 1986 Date-Received: Tue, 30-Sep-86 20:31:06 EDT References: <3672@brl-smoke.ARPA> <108@nonvon.UUCP> Organization: TRW Digital Development Laboratory, Manhattan Beach, CA Lines: 18 Summary: scanf and fscanf have builtin capability to read double precision real numbers, as defined in K&R, page 149. >> I have been wanting to read in some real numbers, preferably thru SCANF >> ... >> declared as DOUBLE. (...) Well, go ahead! K&R, page 149 gives the key to reading in double precision number using the scanf family: "the conversion characters e or f may be preceeded by l (letter l) to indicate that .. a pointer to double rather than float is expected" The code would look like double foo; scanf("%lf",&foo); After having my code bomb several times (unfortunately, I was not as lucky as you - instead of zeroes, I got core dumps), I discovered this little gem in K&R.