HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)
f
fwscanf(3C) fwscanf(3C)
Similarly, the conversion wide-characters
o, u and x must be preceded by
h if the corresponding
argument is a pointer to unsigned short int rather than a pointer to unsigned int, or by
hh if it is
a pointer to unsigned char, or by
j
if it is a pointer to uintmax_t, or by l (ell) if it is a pointer to
unsigned long int, or by
ll (ell-ell) if it is a pointer to unsigned long long, or by
t if it is a pointer
to unsigned ptrdiff_t, or by
z
if it is a pointer to size_t.
The conversion wide-characters
e, f and g must be preceded by
l (ell) if the corresponding argu-
ment is a pointer to double rather than a pointer to float, or by
L if it is a pointer to long double.
If an
h, hh, j
, l (ell), ll (ell-ell), L, t,orz appears with any other conversion wide-character, the
behavior is undefined.
• A conversion wide-character that specifies the type of conversion to be applied. The valid conver-
sion wide-characters are described below.
The
fwscanf() functions execute each directive of the format in turn. If a directive fails, as detailed
below, the function returns. Failures are described as input failures (due to the unavailability of input
bytes) or matching failures (due to inappropriate input).
A directive composed of one or more white-space wide-characters is executed by reading input until no
more valid input can be read, or up to the first wide-character which is not a white-space wide-character,
which remains unread.
A directive that is an ordinary wide-character is executed as follows. The next wide-character is read from
the input and compared with the wide-character that comprises the directive; if the comparison shows that
they are not equivalent, the directive fails, and the differing and subsequent wide-characters remain
unread.
A directive that is a conversion specification defines a set of matching input sequences, as described below
for each conversion wide-character. A conversion specification is executed in the following steps:
Input white-space wide-characters (as specified by
iswspace() ) are skipped, unless the conversion
specification includes a
[, c or n conversion character.
An item is read from the input, unless the conversion specification includes an n conversion wide-
character. An input item is defined as the longest sequence of input wide-characters, not exceeding any
specified field width, which is an initial subsequence of a matching sequence. The first wide-character, if
any, after the input item remains unread. If the length of the input item is 0, the execution of the conver-
sion specification fails; this condition is a matching failure, unless end-of-file, an encoding error, or a read
error prevented input from the stream, in which case it is an input failure. Except in the case of a
%
conversion wide-character, the input item (or, in the case of a
%n conversion specification, the count of
input wide-characters) is converted to a type appropriate to the conversion wide-character. If the input
item is not a matching sequence, the execution of the conversion specification 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 the conversion specification is introduced by %, or in the nth argument if
introduced by the wide-character sequence
%n$. 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.
The following conversion wide-characters are valid:
d Matches an optionally signed decimal integer, whose format is the same as expected for the
subject sequence of wcstol() with the value 10 for the base argument. In the absence of
a size modifier, the corresponding argument must be a pointer to int.
i Matches an optionally signed integer, whose format is the same as expected for the subject
sequence of wcstol() with 0 for the base argument. In the absence of a size modifier,
the corresponding argument must be a pointer to int.
o Matches an optionally signed octal integer, whose format is the same as expected for the
subject sequence of wcstoul() with the value 8 for the base argument. In the absence of
a size modifier, the corresponding argument must be a pointer to unsigned int.
u Matches an optionally signed decimal integer, whose format is the same as expected for the
subject sequence of wcstoul() with the value 10 for the base argument. In the absence
of a size modifier, the corresponding argument must be a pointer to unsigned int.
x Matches an optionally signed hexadecimal integer, whose format is the same as expected
for the subject sequence of wcstoul() with the value 16 for the base argument. In the
absence of a size modifier, the corresponding argument must be a pointer to unsigned int.
482 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: February 2007