int vsscanf ( const char * s, const char * format, va_list arg );
Read formatted data from string into variable argument list
Reads data from s and stores them according to parameter format into the locations pointed by the elements in the variable argument list identified by arg.
Internally, the function retrieves arguments from the list identified by arg as if va_arg was used on it, and thus the state of arg is likely to be altered by the call.
In any case, arg should have been initialized by va_start at some point before the call, and it is expected to be released by va_end at some point after the call.
- C string that the function processes as its source to retrieve the data.
- C string that contains a format string that follows the same specifications as format in scanf (see scanf for details).
- A value identifying a variable arguments list initialized with va_start.
va_list is a special type defined in <cstdarg>.
On success, the function returns the number of items in the argument list successfully filled. This count can match the expected number of items or be less -even zero- in the case of a matching failure.
In the case of an input failure before any data could be successfully interpreted, EOF is returned.
/* vsscanf example */
void GetMatches ( const char * str, const char * format, ... )
va_start (args, format);
vsscanf (str, format, args);
int main ()
GetMatches ( "99 bottles of beer on the wall", " %d %s ", &val, buf);
printf ("Product: %s\nQuantity: %d\n", buf, val);
- Read formatted data into variable argument list (function
- Read formatted data from stream into variable argument list (function
- Read formatted data from string (function
- Read formatted data from stdin (function
- Write formatted data from variable argument list to string (function