HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
f
fwscanf(3C) fwscanf(3C)
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 trailing
white space (including newline) is left unread unless matched by a conversion specification. The success 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
fwscanf(), wscanf(), swscanf() are thread-safe interfaces. After fwscanf() or wscanf() is
applied to a stream, the stream becomes wide-oriented (see orientation(5)).
In format strings containing the % form of conversion specifications, each argument in the argument list is
used exactly once.
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.
[ENOMEM] Insufficient storage space is available.
In addition, fwscanf() may fail if:
[EILSEQ] The stream pointed to by stream is byte-oriented.
In addition, wscanf() may fail if:
[EILSEQ] stdin is byte-oriented.
EXAMPLES
The call:
int i, n; float x; char name[50];
n = wscanf(L"%d%f%s", &i, &x, name);
with the input line:
25 54.32E-1 Hamster
will assign to n the value 3, to i the value 25, x the value 5.432, and name will contain the string
Ham-
ster
.
The call:
int i; float x; char name[50];
(void)wscanf(L"%2d%f%*d %[0123456789]", &i, &x, name);
with input:
56789 0123 56a72
will assign 56 to i, 789.0 to x, skip 0123, and place the string 56 in name. The next call to getchar()
will return the character a.
AUTHOR
fwscanf(), wscanf(), swscanf() were developed by HP and MitsubishiElectric Corporation.
HP-UX Release 11i: December 2000 − 4 − Section 3−−273
___
___