Updating data for an existing key

#include "btree.h"

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

The btupd function updates the data record of an existing key in the file associated with the btact context pointer. Both key and data are character pointers. Since the data may legitimately contain null (x'00) characters, the length of the data, in bytes, must be passed in dsize. If the replacement data is successfully stored in the B Tree file, btupd returns zero.

If btupd is called with a key value of NULL, the update operation will act against the current key, as selected by btsel, btseln or btselp operations. This capability is designed to allow update of a duplicate key, presumably based on other, application managed, attributes.

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