INtime SDK Help
sscanf, sscanf_s, swscanf, swscanf_s

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]...);

Parameters

buffer
Source string.
format
Null-terminated format-control string which controls the interpretation of the input fields and has the same form and function as the format argument as described in scanf.
argument
Optional argument. Must be a pointer to a variable with a type that corresponds to a type specifier in format.

Remarks

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.

Return Values

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.

Generic Text Routines

tchar.h routine _UNICODE not defined _UNICODE defined
_stscanf sscanf swscanf
_stscanf_s sscanf_s swscanf_s

Requirements

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
   
See Also