cfunc.read C Function/C Functions

cfunc.read

Command cfunc.read C Function/C Functions
Applicable release versions: AP 6.1
Category C Functions (120)
Description equivalent to the Pick/BASIC statements depending upon type: read, readu, readu locked

type Pick/BASIC statement

_CP_READ read result from expression,string

_CP_READU readu result from expression,string

_CP_READUL readu result from expression,string locked value = 1 else value = 0

If value is not needed, the user may pass (int*) 0.

The _CP_read call uses the same optimized read routine as FlashBASIC which, from the 6.1 release onwards, is about 2-5 times faster than that which is used by Access and standard Pick/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.
Syntax int _CP_read(int type, CPSTR** result, int expression, CPSTR* string, int* value)
Options
Example
The following example 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);
Purpose
Related cfunc.introduction
cfunc.write
cfunc.writev