Path: utzoo!attcan!uunet!jarthur!mti!adrian From: adrian@mti.mti.com (Adrian McCarthy) Newsgroups: comp.lang.c Subject: Re: Problems with scanf() Message-ID: <1204@mti.mti.com> Date: 29 Oct 90 21:40:07 GMT References: <1990Oct12.154156.25096@murdoch.acc.Virginia.EDU> <1990Oct20.001637.28244@unislc.uucp> <324@brat.UUCP> Reply-To: adrian@mti.UUCP (Adrian McCarthy) Distribution: na Organization: Micro Technology, Anaheim, CA Lines: 17 The VAX C 3.0 library version of sscanf() doesn't handle unsigned values at all (according to the docs). In particular I needed a text to unsigned long conversion. I used the strtoul() function, but I was wondering if anyone knows if 3.1 added this functionality to sscanf(). Also, does Henry Spencer's commandment about checking the return values of all functions for errors apply to sscanf()? Since sscanf() is supposed to return the number of successful conversions, it seems reasonable to do things like: if (sscanf(str, "%d %d", &x, &y) != 2) { fprintf(stderr, "Error parsing string.\n"); exit(PARSE_ERROR); } Right? Aid. (adrian@gonzo.mti.com)