Chapter Contents |
Previous |
Next |
sscanf |
Portability: | ISO/ANSI C conforming, UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <stdio.h> int sscanf(const char *source, const char *format, loc1, loc2, ... );
DESCRIPTION |
sscanf
reads formatted input text from the string addressed by
source
. No file input is performed. Following the format in the argument
list may be one or more additional pointers addressing storage where the input
values are stored.
The string pointed to by
format
is in the same form as that used by
fscanf
. Refer to the
fscanf
description
for detailed information concerning the formatting conventions.
RETURN VALUE |
sscanf
returns
EOF
if end of string (or failure
to match) occurs before any values are stored. If values are stored, it returns
the number of items stored; that is, the number of times a value is assigned
with one of the
sscanf
argument pointers.
Attempting to read past the null terminator of the
source
string is treated like an end of file on the
fscanf
input file.
IMPLEMENTATION |
sscanf
is just like
fscanf
, except that input
data are taken from a string rather than a file.
If
sscanf
encounters
an error in storing input values, it stores the values up to the error and
then stops.
EXAMPLE |
sscanf
is illustrated in the example for
sprintf
.
RELATED FUNCTIONS |
fscanf
,
scanf
,
strtod
,
strtol
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.