wscanf, fwscanf, swscanf, wscanf_s, fwscanf_s, swscanf_s
| Defined in header <wchar.h>
|
||
| (1) | ||
| int wscanf( const wchar_t *format, ... ); |
(since C95) (until C99) |
|
| int wscanf( const wchar_t *restrict format, ... ); |
(since C99) | |
| (2) | ||
| int fwscanf( FILE *stream, const wchar_t *format, ... ); |
(since C95) (until C99) |
|
| int fwscanf( FILE *restrict stream, const wchar_t *restrict format, ... ); |
(since C99) | |
| (3) | ||
| int swscanf( const wchar_t *buffer, const wchar_t *format, ... ); |
(since C95) (until C99) |
|
| int swscanf( const wchar_t *restrict buffer, const wchar_t *restrict format, ... ); |
(since C99) | |
| int wscanf_s( const wchar_t *restrict format, ...); |
(4) | (since C11) |
| int fwscanf_s( FILE *restrict stream, const wchar_t *restrict format, ...); |
(5) | (since C11) |
| int swscanf_s( const wchar_t *restrict s, const wchar_t *restrict format, ...); |
(6) | (since C11) |
Reads data from the a variety of sources, interprets it according to format and stores the results into given locations.
stream.buffer. Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf- any of the arguments of pointer type is a null pointer
-
format,stream, orbufferis a null pointer - the number of characters that would be written by %c, %s, or %[, plus the terminating null character, would exceed the second (rsize_t) argument provided for each of those conversion specifiers
- optionally, any other detectable error, such as unknown conversion specifier
- As all bounds-checked functions,
wscanf_s,fwscanf_s, andswscanf_sare only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including<wchar.h>.
Contents |
[edit] Parameters
| stream | - | input file stream to read from | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| buffer | - | pointer to a null-terminated wide string to read from | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| format | - | pointer to a null-terminated wide string specifying how to read the input. The format string consists of
The following format specifiers are available:
For every conversion specifier other than All conversion specifiers other than If the length specifier The conversion specifiers The correct conversion specifications for the fixed-width integer types ( There is a sequence point after the action of each conversion specifier; this permits storing multiple fields in the same "sink" variable. When parsing an incomplete floating-point value that ends in the exponent with no digits, such as parsing "100er" with the conversion specifier %f, the sequence "100e" (the longest prefix of a possibly valid floating-point number) is consumed, resulting in a matching error (the consumed sequence cannot be converted to a floating-point number), with "r" remaining. Existing implementations do not follow this rule and roll back to consume only "100", leaving "er", e.g. glibc bug 1765
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ... | - | receiving arguments | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[edit] Return value
[edit] Example
| This section is incomplete Reason: no example |
[edit] References
- C11 standard (ISO/IEC 9899:2011):
- 7.29.2.2 The fwscanf function (p: 410-416)
- 7.29.2.4 The swscanf function (p: 417)
- 7.29.2.12 The wscanf function (p: 421)
- K.3.9.1.2 The fwscanf_s function (p: 628-629)
- K.3.9.1.5 The swscanf_s function (p: 631)
- K.3.9.1.14 The wscanf_s function (p: 638)
- C99 standard (ISO/IEC 9899:1999):
- 7.24.2.2 The fwscanf function (p: 356-362)
- 7.24.2.4 The swscanf function (p: 362)
- 7.24.2.12 The wscanf function (p: 366-367)
[edit] See also
| (C99)(C99)(C99)(C11)(C11)(C11) |
reads formatted wide character input from stdin, a file stream or a buffer using variable argument list (function) |
| C++ documentation for wscanf, fwscanf, swscanf
| |