User Tools

Site Tools


Sidebar

Table Of Contents

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

bgetlast

Name

Bgetlast — Get field data from last field occurrence

Synopsis

#include <ubf.h>

int Bgetlast (UBFH *p_ub, BFLDID bfldid, BFLDOCC *occ, char *buf, BFLDLEN *len);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Function is used to get last field occurrence data from UBF buffer. p_ub is pointer to UBF buffer, bfldid is field id to get. occ is variable where to return the occurrence which is read. occ is optional and can be NULL. buf is buffer where to output the data. len is used as input for indicating the lenght of the bytes for the target buffer (buf). If the data is larger than len inidicated, then error of BNOSPACE. Then len is optional. If set to NULL, then no such checks are made. len is used for BFLD_STRING and BFLD_CARRAY. On output len (if not NULL), indicates the length of data loaded in bytes. buf pointed data type must match the field type in buffer.

RETURN VALUE

On success, Bgetlast() 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.

BNOSPACE No space in buf.

BBADFLD Invalid field id passed.

BNOTPRES Field not present.

EXAMPLE

See ubftest/test_get.c for sample code.

BUGS

Report bugs to support@mavimax.com

SEE ALSO

Bchg(3) Badd(3) CBadd(3) CBgetlast(3)

COPYING

© Mavimax, Ltd