Bgetalloc — get the field value from buffer and copy it to newly allocated space
#include <ubf.h>
char * Bgetalloc (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, BFLDLEN *extralen);
Link with -lubf -lnstd -lm -lpthread
Get the field bfldid at occ occurrence from p_ub buffer. The value is returned (copied to) to memory block allocated by function. There is extra parameter extralen. On input it indicates the additional space that shall be allocated, on output it indicates the data length loaded into allocated memory. The extralen can be NULL, in that case no extra memory is allocated.
For BFLD_VIEW type fields, returned value points to allocated/initialized BVIEWFLD structure.
On success, Bgetalloc() pointer to allocated memory block; 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.
BMALLOC Failed to allocate type conversion buffer.
BBADFLD Invalid field passed to bfldid.