Guardian C Library Calls Reference Manual
sscanf
3-172 128833—Guardian TNS C Library Calls Reference Manual
Reference to Library Calls
sscanf
The sscanf function reads formatted data from a character string, uses the format string
to determine whether the data matches expectations and to determine the necessary
conversions, and writes converted data to one or more supplied variables.
str_ptr
points to the data to scan and convert.
format
points to a string that specifies how to convert the input text for assignment, using
subsequent arguments as pointers to the variables that receive the converted input.
Refer to “fscanf” on page 3-61 for a description of format.
obj_ptr...
is a list of pointers to variables, specifying where the results of the conversions
defined in *format are to be stored.
Return Value
is the number of items for which sscanf found valid data, including all single-
character items in *format that were matched. If an error occurs, sscanf returns the
value EOF.
Usage Guidelines
•
The conversion specifiers must agree in number and type with the pointers in
obj_ptr....
•
If you use the suppression feature (*), do not supply a pointer for that specifier.
•
In C-series releases, sscanf returns a -1 if no conversion takes place. In D-series
releases, sscanf returns a 0 if no conversion takes place.
#include <stdioh>
int sscanf(const char *str_ptr, const char *format,
[obj_ptr...]);