scanf question

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Feb 24 00:20:46 AEST 1989


In article <9676 at cit-vax.Caltech.Edu> johns at tybalt.caltech.edu.UUCP (John Salmon) writes:
>"...A white-space directive fails if no white-space can be found."
>K&R 2nd edition says that "white-space directives are ignored"
>Which is correct?

Neither.  A white-space directive is executed by reading input up to
the first non-white-space character (which remains unread), or until
no more characters can be read.  It never fails, by definition.

>  Is count set to 0 or 1 by:
>   count = sscanf("10", " %d", &i);

sscanf returns 1 in this case.



More information about the Comp.std.c mailing list