Zilog ZUSBOPTS User Manual
Page 465

UM017105-0511
Standard Functions
Zilog Developer Studio II – ZNEO™
User Manual
437
a pointer to
long_int
. Similarly, the conversion character u can be preceded by h to
indicate that the corresponding argument is a pointer to
unsigned_short_int
rather than a pointer to
unsigned_int
, or by l to indicate that it is a pointer to
unsigned_long_int
. Finally, the conversion character e, f, and g can be preceded
by l to indicate that the corresponding argument is a pointer to double rather than a
pointer to float, or by L to indicate a pointer to
long_double
. If an h, l, or L appears
with any other conversion character, it is ignored.
4. A character that specifies the type of conversion to be applied. The valid conversion
characters are described in the following paragraphs.
The
scanf
function executes each directive of the format in turn. If a directive fails, as
detailed below, the
scanf
function returns. Failures are described as input failures (due to
the unavailability of input characters), or matching failures (due to inappropriate input).
A directive composed of white space is executed by reading input up to the first non-
white-space character (which remains unread), or until no more characters can be read. A
white-space directive fails if no white-space character can be found.
A directive that is an ordinary character is executed by reading the next character of the
stream. If the character differs from the one comprising the directive, the directive fails,
and the character remains unread.
A directive that is a conversion specification defines a set of matching input sequences, as
described below for each character. A conversion specification is executed in the follow-
ing steps:
1. Input white-space characters (as specified by the
isspace
function) are skipped,
unless the specification includes a ’[’, ’c,’ or ’n’ character.
2. An input item is read from the stream, unless the specification includes an n character.
An input item is defined as the longest sequence of input characters (up to any speci-
fied maximum field width) which is an initial subsequence of a matching sequence.
The first character, if any, after the input item remains unread. If the length of the input
item is zero, the execution of the directive fails: this condition is a matching failure,
unless an error prevented input from the stream, in which case it is an input failure.
3. Except in the case of a % character, the input item (or, in the case of a
%n
directive, the
count of input characters) is converted to a type appropriate to the conversion charac-
ter. If the input item is not a matching sequence, the execution of the directive fails:
this condition is a matching failure. Unless assignment suppression was indicated by a
*, the result of the conversion is placed in the object pointed to by the first argument
following the format argument that has not already received a conversion result. If this
object does not have an appropriate type, or if the result of the conversion cannot be
represented in the space provided, the behavior is undefined.