Newsgroups: comp.lang.c Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Problems with scanf() Message-ID: <1990Oct30.173304.26623@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1990Oct12.154156.25096@murdoch.acc.Virginia.EDU> <1990Oct20.001637.28244@unislc.uucp> <324@brat.UUCP> <1204@mti.mti.com> Date: Tue, 30 Oct 90 17:33:04 GMT In article <1204@mti.mti.com> adrian@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@zoo.toronto.edu utzoo!henry