_CP_read is equivalent to the read, readu and readu locked BASIC statements (depending upon type):
|_CP_READ||read result from expression,string|
|_CP_READU||readu result from expression,string|
|_CP_READUL|| readu result from expression,string locked value = 0 else value = 1
If value is not needed, the user can pass (int*) 0.
int _CP_read(int type, CPSTR** result, int expression, CPSTR* string, int* value)
The _CP_read call uses the same optimized read routine as BASIC, which is faster than using AQL and BASIC. The expression should be an integer file descriptor returned by the _CP_open call.
This function returns -1 if an error occurs. The error code is contained in _CP_errno.
/* Reads the item "myid"from "myfile". */ CPSTR * s = _CP_mkstr("myfile"); CPSTR * id = _CP_mkstr("myid"); CPSTR * xx = _CP_str_null; int f; _CP_open(&f,_CP_str_null,s); _CP_read(_CP_READ, &xx, f, id, 0);