Article View: comp.std.c
Article #6142Another scanf interpretation question
From: Chris Torek
Date: Thu, 04 Jan 1990 08:31
Date: Thu, 04 Jan 1990 08:31
21 lines
1082 bytes
1082 bytes
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@cs.umd.edu Path: uunet!mimsy!chris
Technical Details
Message-ID:
<21624@mimsy.umd.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!xanth!ames!dftsrv!mimsy!chrisShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!xanth!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.std.c Subject: Another scanf interpretation question Message-ID: <21624@mimsy.umd.edu> Date: 4 Jan 90 08:31:35 GMT Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 21