Finding a reverse sequence of keys
#include "btree.h"
int bprvky(BTA* btact, char* key, BTint* value);
The bprvky function returns the previous key
from the current root in the file associated with the
btact context pointer. The key, a
character string, is returned via the pointer in
key. The value associated with the key
will be returned in the integer location identified by
value. value is
declared as a BTint, which is normally a typedef for
int, but with Large File Support will be
a typedef for long long.
bprvky returns zero to indicate the previous
key has been located. If no previous key exists,
bnxtky returns the error code
QNOKEY.
To initialise the B Tree position, a call to bfndky or btpos must be
made before the first call to bprvky.
Thereafter, repeated calls to bprvky may
be made. Calls to bnxtky may be
freely intermingled with calls to bprvky.
bprvky is prohibited when an index file
is opened in shared mode and the current root supports
duplicate keys. To use bprvky in this
case, exclusive access to the index file must be gained via
the btlock
function.
A non-zero return from bprvky
indicates an error occurred during the key location process.