cfunc.readv C Function/C Functions

cfunc.readv

Command cfunc.readv C Function/C Functions
Applicable release versions: AP 6.1
Category C Functions (120)
Description equivalent to the Pick/BASIC statement: readv

Depending upon type, _CP_read acts as the following Pick/BASIC commands:

type Pick/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

The value parameter returns a 1 if the item is locked.

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

The _CP_readv 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 expression1 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. If the attribute number is bad, then _CP_errno will contain PE_BADATTR.
Syntax int _CP_readv(int type, CPSTR** result, int expression1, CPSTR* string, int expression2, int* value)
Options
Example
/* The following example 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);
Purpose
Related cfunc.introduction
cfunc.writev