cfunc.get C Function/C Functions

cfunc.get

Command cfunc.get C Function/C Functions
Applicable release versions: AP 6.1
Category C Functions (120)
Description equivalent to the Pick/BASIC statement: get result, expression1 setting expression2 from expression3 until string1 returning string2, waiting expression4

The type parameter is bit mask that may 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 a 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.
Syntax int _CP_get(int type, CPSTR** result, int expression1, int expression2, int expression3, CPSTR* string1, CPSTR** string2, int expression4)
Options
Example
/* The following example 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);
Purpose
Related cfunc.introduction