0001 BGETLAST(3)
0002 ===========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bgetlast - Get field data from last field occurrence
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 int Bgetlast (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC *'occ', char *'buf', BFLDLEN *'len');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 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.
0023
0024 RETURN VALUE
0025 ------------
0026 On success, *Bgetlast()* return zero; on error, -1 is returned, with *Berror* set to indicate the error.
0027
0028 ERRORS
0029 ------
0030 Note that *Bstrerror()* returns generic error message plus custom message with debug info from last function call.
0031
0032 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0033
0034 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0035
0036 *BNOSPACE* No space in 'buf'.
0037
0038 *BBADFLD* Invalid field id passed.
0039
0040 *BNOTPRES* Field not present.
0041
0042 EXAMPLE
0043 -------
0044 See *ubftest/test_get.c* for sample code.
0045
0046 BUGS
0047 ----
0048 Report bugs to support@mavimax.com
0049
0050 SEE ALSO
0051 --------
0052 *Bchg(3)* *Badd(3)* *CBadd(3)* *CBgetlast(3)*
0053
0054 COPYING
0055 -------
0056 (C) Mavimax, Ltd
0057