Bfindocc — find field occurrence in buffer by given value
#include <ubf.h>
BFLDOCC Bfindocc (UBFH *p_ub, BFLDID bfldid, char *buf, BFLDLEN len);
Link with -lubf -lnstd -lm -lpthread
Function on success returns the occurrence of the field found in p_ub buffer. The value is searched by buf/len pair which value matches the field value. p_ub is pointer to UBF buffer, bfldid is field id to search for, len is input paramter for indicating the but length in bytes. Then len is mandatory only for BFLD_CARRAY fields.
On success, Bfindocc() return occurrence where the value is found; on error, -1 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.
BEINVAL buf is NULL.
BBADFLD invalid field passed in (type incorrect).