Bchgs — Change (add or update) field occurrance in UBF buffer by given string value
#include <ubf.h>
int Bchgs (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, char *buf);
Link with -lubf -lnstd -lm -lpthread
Change (add or update) field in UBF buffer by given user string value. The UBF buffer pointer is passed by p_ub, field id in bfldid. occ is occurrance to change. The string field value is passed in buf. buf is automatically converted to corresponding field type.
If occ is bigger than last existing index+1 in buffer then non existing occurrences (which are not being set directly by this function) are initialised with defaults. For numerics it is 0, for BFLD_CHAR it is 0x00, for BFLD_STRING it is empty string, for BFLD_CARRAY it is empty byte array (with length 0).
Bchgs() basically is the same as CBchgs(3) passed in with BFLD_STRING type.
On success, Bchgs() return zero; 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.
BNOSPACE No space in buffer for string data.
BBADFLD Invalid field id passed.
BMALLOC Failed to allocate type conversion buffer.