C examples for stdio.h:vscanf
function
<cstdio> <stdio.h>
Read formatted data into variable argument list
int vscanf ( const char * format, va_list arg );
Parameter | Description |
---|---|
format | a format string |
arg | a variable arguments list initialized with va_start. |
On success, the function returns the number the argument filled.
#include <stdio.h> #include <stdarg.h> void GetMatches ( const char * format, ... ) { va_list args;/* www .java 2 s . com*/ va_start (args, format); vscanf (format, args); va_end (args); } int main () { int val; char str[100]; printf ("Please enter a number and a word: "); fflush (stdout); GetMatches (" %d %99s ", &val, str); printf ("Number read: %d\nWord read: %s\n", val, str); return 0; }