User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:ubf:cbgetalloc.3

cbgetalloc

Name

CBgetalloc — get the field value from buffer and copy it to newly allocated space, converted to user type

Synopsis

#include <ubf.h>

char * CBgetalloc (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, int usrtype, BFLDLEN *extralen);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Get the field bfldid at occ occurrence from p_ub buffer. The value is converted to usrtype. 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. The extralen can be NULL, in that case no extra memory is allocated.

Function is based on Bgetalloc(3), which does not convert to user type, but returns direct value.

RETURN VALUE

On success, CBgetalloc() return zero; on error, -1 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.

BTYPERR Invalid user type specified.

EXAMPLE

See ubftest/test_get.c for sample code.

BUGS

Report bugs to support@mavimax.com

SEE ALSO

Bchg(3) Badd(3) CBadd(3) Bfind(3) Bgetalloc(3)

COPYING

© Mavimax, Ltd