In defense of scanf() (Re: Re^2: scanf(..))

Peter da Silva peter at ficc.uu.net
Thu Jun 15 23:48:09 AEST 1989


In article <3145 at buengc.BU.EDU>, bph at buengc.BU.EDU (Blair P. Houghton) writes:
> When filtering tabular data from files, or dealing in a situation where
> a precise syntax is necessary, the `fgets(..); sscanf(..)' doublet just
> adds uncertainty and complexity to a simple problem to which scanf is
> suited ideally.

Eeep and Yoicks yourself. I suspect this is another religious issue, but given
scanf's habit of trashing indeterminate amounts of input and ignoring newlines
if you have anything wrong with your format string, well... precision and
scanf just don't belong in the same sentence.

I tend to stick with strspn() and strtok(), myself.
-- 
Peter da Silva, Xenix Support, Ferranti International Controls Corporation.

Business: uunet.uu.net!ficc!peter, peter at ficc.uu.net, +1 713 274 5180.
Personal: ...!texbell!sugar!peter, peter at sugar.hackercorp.com.



More information about the Comp.lang.c mailing list