cnet v4.0.4  

home topology files command‑line options the core API FAQ download and install

cnet's Application Programming Interface

NAME
CNET_read_keyboard - read a line of input from the node's keyboard

SYNOPSIS
#include <cnet.h> int CNET_read_keyboard(void *line, int *length);

DESCRIPTION
Requests the specified maximum number of bytes from the keyboard buffer placing them in the address pointed to by line. On invocation, length will point to an integer indicating the maximum number of bytes that may be copied into line.

On return, line will contain a NULL-byte terminated string of characters (not including a newline character) and the integer pointed to by length will contain strlen(line)+1.

CNET_read_keyboard() should be called from within the handler for the EV_KEYBOARD event. There is no mechanism to "poll" the keyboard to see if any key has been pressed.

RETURN VALUE
The value 0 is returned on success. On failure, the value -1 is returned, and the global variable cnet_errno is set to one of the following values to describe the error:

ER_BADARG
Either line or length is an invalid pointer, or the value pointed to by length is less than or equal to zero.
ER_BADSIZE
The value pointed to by length is not long enough to receive the keyboard input.
ER_NOTREADY
The function has not been called in response to an EV_KEYBOARD event.
ER_NOTSUPPORTED
The function has been called from a nodetype that does not have a keyboard.

cnet v4.0.4 - [email protected]