132,12 → 132,14 |
|
Each format specification begins with the percent character (<<%>>). |
The other fields are: |
o+ |
O+ |
o * |
|
an optional marker; if present, it suppresses interpretation and |
assignment of this input field. |
|
o <[width]> |
|
an optional maximum field width: a decimal integer, |
which controls the maximum number of characters that |
will be read before converting the current input field. If the |
150,59 → 152,116 |
to that character are read, converted, and stored. |
Then <<scanf>> proceeds to the next format specification. |
|
o size |
o <[size]> |
|
<<h>>, <<j>>, <<l>>, <<L>>, <<t>>, and <<z>> are optional size |
characters which override the default way that <<scanf>> |
interprets the data type of the corresponding argument. |
|
@multitable @columnfractions 0.18 0.30 0.52 |
@headitem |
Modifier |
@tab |
Type(s) |
@tab |
@item |
hh |
@tab |
d, i, o, u, x, n |
@tab |
convert input to char, store in char object |
@item |
h |
@tab |
d, i, o, u, x, n |
@tab |
convert input to short, store in short object |
@item |
h |
@tab |
D, I, O, U, X, e, f, c, s, p |
@tab |
no effect |
@item |
j |
@tab |
d, i, o, u, x, n |
@tab |
convert input to intmax_t, store in intmax_t object |
@item |
j |
@tab |
all others |
@tab |
no effect |
@item |
l |
@tab |
d, i, o, u, x, n |
@tab |
convert input to long, store in long object |
@item |
l |
@tab |
e, f, g |
@tab |
convert input to double, store in a double object |
@item |
l |
@tab |
D, I, O, U, X, c, s, p |
@tab |
no effect |
@item |
ll |
@tab |
d, i, o, u, x, n |
@tab |
convert to long long, store in long long object |
@item |
L |
@tab |
d, i, o, u, x, n |
@tab |
convert to long long, store in long long object |
@item |
L |
@tab |
e, f, g, E, G |
@tab |
convert to long double, store in long double object |
@item |
L |
@tab |
all others |
@tab |
no effect |
@item |
t |
@tab |
d, i, o, u, x, n |
@tab |
convert input to ptrdiff_t, store in ptrdiff_t object |
@item |
t |
@tab |
all others |
@tab |
no effect |
@item |
z |
@tab |
d, i, o, u, x, n |
@tab |
convert input to size_t, store in size_t object |
@item |
z |
@tab |
all others |
@tab |
no effect |
@end multitable |
|
.Modifier Type(s) |
. hh d, i, o, u, x, n convert input to char, |
. store in char object |
. |
. h d, i, o, u, x, n convert input to short, |
. store in short object |
. |
. h D, I, O, U, X no effect |
. e, f, c, s, p |
. |
. j d, i, o, u, x, n convert input to intmax_t, |
. store in intmax_t object |
. |
. j all others no effect |
. |
. l d, i, o, u, x, n convert input to long, |
. store in long object |
. |
. l e, f, g convert input to double |
. store in a double object |
. |
. l D, I, O, U, X no effect |
. c, s, p |
. |
. ll d, i, o, u, x, n convert to long long, |
. store in long long |
. |
. L d, i, o, u, x, n convert to long long, |
. store in long long |
. |
. L e, f, g, E, G convert to long double, |
. store in long double |
. |
. L all others no effect |
. |
. t d, i, o, u, x, n convert input to ptrdiff_t, |
. store in ptrdiff_t object |
. |
. t all others no effect |
. |
. z d, i, o, u, x, n convert input to size_t, |
. store in size_t object |
. |
. z all others no effect |
. |
|
|
o <[type]> |
|
A character to specify what kind of conversion |
245,7 → 304,6 |
Reads an unsigned decimal integer into the corresponding |
<[arg]>: <<(unsigned int *arg)>>. |
|
|
o U |
Reads an unsigned decimal integer into the corresponding <[arg]>: |
<<(unsigned long *arg)>>. |
316,7 → 374,7 |
|
where objects inclosed in square brackets are optional, and <<ddd>> |
represents decimal, octal, or hexadecimal digits. |
o- |
O- |
|
RETURNS |
<<scanf>> returns the number of input fields successfully |
430,6 → 488,12 |
return ret; |
} |
|
#ifdef _NANO_FORMATTED_IO |
int |
_EXFUN(siscanf, (const char *, const char *, ...) |
_ATTRIBUTE ((__alias__("sscanf")))); |
#endif |
|
#endif /* !_REENT_ONLY */ |
|
#ifdef _HAVE_STDC |
467,3 → 531,9 |
va_end (ap); |
return ret; |
} |
|
#ifdef _NANO_FORMATTED_IO |
int |
_EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...) |
_ATTRIBUTE ((__alias__("_sscanf_r")))); |
#endif |