User Tools

Site Tools


Sidebar

Table Of Contents

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

bfind

Name

Bfindlast — find the last value and occurrence of the field in UBF buffer

Synopsis

#include <ubf.h>

char * Bfindlast (UBFH *p_ub, BFLDID bfldid, BFLDOCC *occ, BFLDLEN *len);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Function on success returns pointer to data field present in UBF buffer. p_ub is pointer to UBF buffer, bfldid is field id, occ is field occurrence at which last field was found. occ can be NULL, in that case the occurrence value is not returned. p_len is output paramter for indicating the type length in bytes. Then len is optional. Note that pointer to field is valid only that time while the buffer is not changed. If changes occurr, then returned pointer might become invalid (point wrong data area).

Difference between Bfind(3) is that this function returns the last occurrence in occ variable instead of consuming the occ to return exact field.

RETURN VALUE

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

BBADFLD Invalid field id passed in.

EXAMPLE

See ubftest/test_find.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd