Reads and formats character data from a string.
#include <stdio.h> int sscanf (const char *buffer, const char *format[, argument]...);
int sscanf_s(const char *buffer, const char *format[, argument]...);
#include <wchar.h>
int swscanf(const wchar_t *buffer, const wchar_t *format[, argument]...);
int swscanf_s(const wchar_t *buffer, const wchar_t *format[, argument]...);
buffer
format
argument
Reads data from buffer into the locations given by argument (if any).
sscanf reads all characters in buffer up to the first whitespace character (space, tab, or newline), or the first character that format
cannot convert. If there are too many arguments for the given format, the extra arguments are evaluated but ignored. The results are unpredictable if there are not enough arguments for the format specification.
swscanf is equivalent to sscanf but the input buffer and the format strings are wide-character strings.
sscanf_s and swscanf_s are the safe versions of sscanf and swscanf respectively. Parameter checking is performed. If either of buffer or format are NULL then the functions return EOF.
The number of fields that were successfully converted and assigned, but not fields that were read but not assigned. This number can be fewer than provided for, or even zero in the case of a matching failure.
Returns EOF if an input failure occurs before any conversion.
tchar.h routine |
_UNICODE not defined |
_UNICODE defined |
---|---|---|
_stscanf | sscanf | swscanf |
_stscanf_s | sscanf_s | swscanf_s |
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 INtime 6.0 (for the wide-character and generic text versions) |
intime/rt/include/stdio.h intime/rt/include/wchar.h intime/rt/inculde/tchar.h |
stdio.h wchar.h tchar.h |
clib.lib |