[Previous]
[Contents]
[Next]

cscanf()

scan input from the console

Synopsis:

#include <conio.h>
int cscanf( const char *format, ... );

Description:

The cscanf() function scans input from the console under control of the argument format. Following the format string is a list of addresses to receive values. The cscanf() function uses the function getche() to read characters from the console. The format string is described under the description of the scanf() function.

Returns:

The cscanf() function returns EOF when the scanning is terminated by reaching the end of the input stream. Otherwise, the number of input arguments for which values were successfully scanned and stored is returned. When a file input error occurs, the errno global variable may be set.

Examples:

To scan a date in the form "Saturday April 18 1987":

#include <conio.h>

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

    cscanf( "%s %s %d %d",
        weekday, month, &day, &year);
    cprintf( "\n%s, %s %d, %d\n",
        weekday, month, day, year );
  }

Classification:

WATCOM

Safety:
Interrupt handler No
Signal handler Yes, but modifies errno
Thread Yes

See also:

errno, fscanf(), getche(), scanf(), sscanf(), vcscanf(), vfscanf(), vscanf(), vsscanf()


[Previous]
[Contents]
[Next]