#include <stdio.h> int sscanf(const char *source, const char *format, loc1, loc2, ... );
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.
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.
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.
sscanf
is illustrated in the example for sprintf
.
fscanf
, scanf
, strtod
, strtol
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.