Locating data for an existing key

#include "btree.h"

int btsel(BTA* btact, char* key, char* data, int dsize, int* rsize);

The btsel function locates and returns the data record of an existing key in the file associated with the btact context pointer. 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), btsel returns zero.

An application program can determine the number of bytes occupied by a data record through the btrecs function.

A non-zero return from btsel indicates an error occurred.