User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v8.0.x:api:ubf:bgetalloc.3

bgetalloc

Name

Bgetalloc — get the field value from buffer and copy it to newly allocated space

Synopsis

#include <ubf.h>

char * Bgetalloc (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, BFLDLEN *extralen);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

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.

RETURN VALUE

On success, Bgetalloc() pointer to allocated memory block; on error, NULL is returned, with Berror set to indicate the error.

ERRORS

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.

EXAMPLE

See ubftest/test_get.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd