_CP_get

_CP_get is equivalent to the following BASIC statement:

get result, expression1 setting expression2 from expression3
until string1 returning string2, waiting expression4

Syntax

int _CP_get(int type, CPSTR** result, int expression1, int expression2,
int expression3, CPSTR* string1, CPSTR** string2, int expression4)

The type parameter is a bit mask that can be used to set various options:

_CP_GET_X The getx form of get.
_CP_GET_LEN A desired length is present.
_CP_GET_SET A setting parameter is present.
_CP_GET_UNTIL An until parameter is present.
_CP_GET_RTN A returning parameter is present.
_CP_GET_WAIT A waiting parameter is present.
_CP_GET_THEN_ELSE Then/Else condition.
_CP_GET_ELSE Else only condition.

This function returns -1 if an error occurs. The error code is contained in _CP_errno.

Example(s)

/* Gets input from port 1. */
 
CPSTR * s = _CP_mkstr("dev-att 1");
CPSTR * c = _CP_str_null;
CPSTR * r = _CP_str_null;
 
_CP_execute(_CP_EXECUTE,s,&c,&r);
_CP_get(_CP_GET_X+_CP_GET_LEN, &r, 1, 0, 1, c, &c, 50);