HP C/iX Library Reference Manual (30026-90004)
Chapter 5 325
HP C/iX Library Function Descriptions
sscanf
sscanf
Reads formatted data from a character string in memory.
Syntax
#include <stdio.h>
int sscanf (const char *
string
, const char *
format
[,item [,item]...]
);
Parameters
string
A pointer to a buffer in memory containing the formatted data to be read.
format
A pointer to a character string defining the format of the data to be read
(or the character string itself enclosed in double quotes).
item
The address of a variable into which the data will be placed. Refer below
for descriptions of conversion specifications.
Return Values
≥0 The number of successfully matched and assigned input items.
EOF An error occurred on input (no input characters, or a matching error
occurred before any conversion).
Description
The sscanf function reads externally formatted data from a buffer in memory, converts
the data to internal format, and stores the results in a group of arguments. The format
consists of white-space characters, conversion specifications, and literal characters.
The sscanf function returns the number of successfully matched and assigned input items
or returns EOF if there are no input characters available or if a matching error occurred
before any conversion was made.
This function behaves identically to the scanf() function except that sscanf() reads data
from a character string instead of from stdin.
White-Space Characters
White-space characters (blanks, tabs, newlines, or form feeds) cause input to be read up to
the next non-white-space character.
Conversion Specifications
A conversion specification is a character sequence that tells sscanf() how to interpret the
data received at that point in the input.
In the format, a
conversion specification
is introduced by a percent sign (%),