vscanf, vfscanf and vsscanf
Syntax:
#include <cstdarg> #include <cstdio> int vscanf( char *format, va_list arg_ptr ); int vfscanf( FILE *stream, const char *format, va_list arg_ptr ); int vsscanf( char *buffer, char *format, va_list arg_ptr );
These functions are very much like scanf(), fscanf(), and sscanf(). The difference is that the argument list is a pointer to a list of arguments. va_list is defined in cstdarg, and is also used by va_arg. For example:
int scanf_( char *fmt, ... ) { va_list args; va_start( args, fmt ); int r = vscanf(frmt, args); scanf("%*[^\n]"), getchar(); //Empty buffer va_end( args ); return r; }