Bfind — Find the field in UBF buffer, return raw pointer to value
#include <ubf.h>
char * Bfind (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, BFLDLEN *p_len);
Link with -lubf -lnstd -lm -lpthread
Function on success returns pointer to data field present in UBF buffer. p_ub is pointer to UBF buffer, bfldid is field id, occ is field occurrence at buffer, which needs to be found. p_len is output parameter for indicating the type length in bytes. Then len is optional. Note that pointer to field is valid only that time while the buffer is not changed. If changes occur, then returned pointer might become invalid (point wrong data area).
When Bfind() returns result for BFLD_VIEW field, the return value points to BVIEWFLD structure which resits in thread-local storage. The data field of structure pointers to UBF buffers actual view data.
On success, Bfind() non NULL value is returned; on error, NULL is returned, with Berror set to indicate the error.
Note that Bstrerror() returns generic error message plus custom message with debug info from last function call.
BALIGNERR Corrupted buffer or pointing to not aligned memory area.
BNOTFLD Buffer not fielded, not correctly allocated or corrupted.
BNOTPRES Field not present.
BBADFLD Invalid field id passed.