Problems with scanf()

Henry Spencer henry at zoo.toronto.edu
Wed Oct 31 04:33:04 AEST 1990


In article <1204 at mti.mti.com> adrian at mti.UUCP (Adrian McCarthy) writes:
>Also, does Henry Spencer's commandment about checking the return values of all
>functions for errors apply to sscanf()? ...
>  if (sscanf(str, "%d %d", &x, &y) != 2) {

So long as you are checking the return value, and not just blindly assuming
that sscanf will work, that satisfies the intent of the commandment.
-- 
"I don't *want* to be normal!"         | Henry Spencer at U of Toronto Zoology
"Not to worry."                        |  henry at zoo.toronto.edu   utzoo!henry



More information about the Comp.lang.c mailing list