_CP_readv is equivalent to the readv BASIC statement.
Depending upon type, _CP_read acts as these BASIC commands:
Type |
BASIC Statement |
_CP_READV |
readv result from expression1, string, expression2 |
_CP_READVU |
readvu result from expression1, string, expression2 |
_CP_READVUL |
readvu result from expression, string, expression2 |
Syntax
int _CP_readv(int type, CPSTR** result, int expression1, CPSTR* string, int expression2, int* value) |
The value parameter returns a 1 if the item is locked. If value is not needed, the user can pass (int*) 0.
The _CP_readv call uses the same optimized read routine as BASIC, which is faster than using AQL and BASIC. expression1 should be an integer file descriptor returned by the _CP_open call.
Description
This function returns -1 if an error occurs. The error code is contained in _CP_errno. If the attribute number is bad, then _CP_errno will contain PE_BADATTR.
Example(s)
/* Reads the first attribute of 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_readv(_CP_READV, xx, f, id, 1, 0); |
See Also