Everything

scanf


Read and interpret text from standard output stream

Remark

These functions are not supported by the debugging functions which CS+ provides.

[Classification]

Standard library

[Syntax]

#include <stdio.h>

int scanf(const char *format[, arg, ...]);

[Return value]

The number of input fields for which scanning, conversion, and storage were executed normally is returned. The return value does not include scanned fields that were not stored. If an attempt is made to read to the end of the file, the return value is EOF. If no field was stored, the return value is 0.

[Description]

Reads the input to be converted according to the format specified by the character string pointed to by format from the standard input/output stdin and treats the arg arguments that follow format as objects for storing the converted input. The method of specifying format is the same as described for the sscanf function.

[Example]

#include    <stdio.h>
void func(void) {
        int     i, n;
        double  x;
        char    name[10];
        n = scanf("%d%lf%s", &i, &x, name); /*Perform formatted input of input from 
                                              stdin using the format 
                                              "23 11.1e-1 NAME".*/
}