#include "btree.h"
int btseln(
BTA* btact, char* key, char* data, int dsize, int* rsize)
;
The btseln
function locates and returns
the next key and data record in the file associated with the
btact
context pointer. Before using
btseln
, a call to btsel
or btpos
must be made
to initialise the position within the B Tree. Calls to btselp
may be
freely intermingled with calls to btseln
.
Both key
and
data
are character pointers. The
dsize
parameter must contain the
maximum number of bytes to be returned. The caller should
ensure that the data
pointer refers to
an area of memory of at least dsize
bytes. The actual number of bytes returned is returned in
rsize
. Even if the data record
contains more than dsize
bytes, only
dsize
bytes will be returned. If the
data record is successfully retrieved (even partially),
btseln
returns zero.
If no next key exists, btseln
will return
the error code QNOKEY
.
An application program can determine the number of bytes
occupied by a data record through the btrecs
function.
A non-zero return from btseln
indicates
an error occurred.