Another scanf interpretation question
Chris Torek
chris at mimsy.umd.edu
Thu Jan 4 19:31:35 AEST 1990
The December 1988 draft standard indicates that for %[dioux] scanf
conversions (and their |long| and suppressed-assignment variants),
the format of the number is to match that accepted by strtol or
strtoul. This is all well and good, except that strtol and strtoul
are defined such that they `accept' numbers of the form
+
and
-
(which both convert to the value 0). This is reasonable for strtol
and strtoul, but perhaps not so for scanf.
The question, then, can be expressed this way:
Should sscanf("+", "%d", &i) convert one integer, putting 0 in `i'?
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.std.c
mailing list