CBfindocc — find field occurrence in buffer by given user value
#include <ubf.h>
BFLDOCC CBfindocc (UBFH *p_ub, BFLDID bfldid, char *buf, BFLDLEN len, int usrtype);
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 converted from user type specified in usrtype. p_ub is pointer to UBF buffer, bfldid is field id, len is input paramter for indicating the user type length in bytes. Then len is mandatory only for BFLD_CARRAY fields.
Function basically is the same as Bfindocc(3), only this version includes user type conversion to buffer type before compare.
On success, CBfindocc() 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.
BMALLOC Failed to allocate type conversion buffer.
BTYPERR Invalid user type.
BEINVAL buf is NULL.