fwscanf.3c (2010 09)

f
fwscanf(3C) fwscanf(3C)
fwprintf() functions. The corresponding argument must be a pointer to a pointer to
void. If the input item is a value converted earlier during the same program execution,
the pointer that results will compare equal to that value; otherwise the behavior of the
%p conversion is undefined.
n No input is consumed. The corresponding argument must be a pointer to the integer into
which is to be written the number of wide-characters read from the input so far by this
call to the fwscanf() functions. Execution of a
%n conversion specification does not
increment the assignment count returned at the completion of execution of the function.
C Same as lc.
S Same as
ls.
% Matches a single %; no conversion or assignment occurs. The complete conversion
specification must be %%.
If a conversion specification is invalid, the behavior is undefined.
The conversion characters
A, E, F
, G and X are also valid and behave the same as, respectively,
a, e, f,
g and x.
If end-of-file is encountered during input, conversion is terminated. If end-of-file occurs before any wide-
characters matching the current conversion specification (except for
%n) have been read (other than lead-
ing white-space, where permitted), execution of the current conversion specification terminates with an
input failure. Otherwise, unless execution of the current conversion specification is terminated with a
matching failure, execution of the following conversion specification (if any) is terminated with an input
failure.
Reaching the end of the string in
swscanf() is equivalent to encountering end-of-file for fwscanf()
.
If conversion terminates on a conflicting input, the offending input is left unread in the input. Any trail-
ing white space (including newline) is left unread unless matched by a conversion specification. The suc-
cess of literal matches and suppressed assignments is only directly determinable via the
%n conversion
specification.
The
fwscanf() and wscanf() functions may mark the st_atime field of the file associated with
stream for update. The st_atime field will be marked for update by the first successful execution of
fgetc(), fgetwc(), fgets(), fgetws(), fread(), getc(), getwc(), getchar(),
getwchar(), gets(), fscanf() or fwscanf() using stream that returns data not supplied by a
prior call to ungetc().
APPLICATION USAGE
After
fwscanf() or wscanf() is applied to a stream, the stream becomes wide-oriented (see orienta-
tion (5)).
In format strings containing the
% form of conversion specifications, each argument in the argument list is
used exactly once.
The prototypes of these functions are available to applications if they are:
a.
c99 conformant.
b. Compiled with
-D_XOPEN_SOURCE macro with a value >=500.
c. Compiled with
-D_POSIX_C_SOURCE macro with a value >= 200112.
RETURN VALUE
Upon successful completion, these functions return the number of successfully matched and assigned
input items; this number can be 0 in the event of an early matching failure. If the input ends before the
first matching failure or conversion,
EOF is returned. If a read error occurs the error indicator for the
stream is set, EOF is returned, and errno is set to indicate the error.
ERRORS
For the conditions under which the
fwscanf() functions will fail and may fail, refer to fgetwc().In
addition, fwscanf() may fail if:
[EILSEQ] Input byte sequence does not form a valid character.
[EINVAL] There are insufficient arguments.
4 Hewlett-Packard Company 4 HP-UX 11i Version 3: September 2010