cobgetch

Gets a character from the keyboard.
Restriction: This function is supported for native COBOL only.

Syntax:

#include "cobscreen.h"

int cobgetch (void);

Parameters:

None.

Comments:

Reads a character from the keyboard and returns it. If no character is pending this routine waits until a key is pressed.

A value of -1 is returned on error (for example, EOF).

Equivalent COBOL Syntax:

call "CBL_READ_KBD_CHAR" using ...

Example:

The following code asks for a Yes/No response:

int ch;

cobaddstrc("Continue [y/n]? ");

ch = cobgetch();

if (ch == 'Y' || ch == 'y')
{
    /* Yes */