vscanf()

Scan input from standard input (varargs)

Synopsis:

#include <stdio.h>
#include <stdarg.h>

int vscanf( const char * format,
            va_list args );

Arguments:

format
A string that specifies the format of the input. For more information, see scanf(). The formatting string determines what additional arguments you need to provide.
args
A variable-argument list of the additional arguments, which you must have initialized with the va_start() macro.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The vscanf() function scans input from stdin, under control of the argument format. For information about the format string, see the description of scanf().

The vscanf() function is a "varargs" version of scanf().

Returns:

The number of input arguments for which values were successfully scanned and stored, or EOF when the scanning is stopped by reaching the end of the input stream before storing any values.

Errors:

If an error occurs, errno indicates the type of error.

Examples:

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

void find( char *format, ... )
  {
    va_list arglist;

    va_start( arglist, format );
    vscanf( format, arglist );
    va_end( arglist );
  }

int main( void )
  {
    int day, year;
    char weekday[10], month[12];

    ffind( "%s %s %d %d",
        weekday, month, &day, &year );
    printf( "\n%s, %s %d, %d\n",
        weekday, month, day, year );
    return EXIT_SUCCESS;
  }

Classification:

ANSI, POSIX 1003.1

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes