0001 BGETSA(3)
0002 =========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bgetsa - get the field, convert to string and copy to allocated memory
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 char * Bgetsa (UBFH *p_ub, BFLDID bfldid, BFLDOCC occ, BFLDLEN *extralen);
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Function is used to get field data from UBF buffer. 'p_ub' is pointer to UBF buffer, 'bfldid' is field id, 'occ' is field occurrence at buffer, which needs to be read. The value of the field is returned by this function. The pointer returned is memory block allocated by this function. Later this needs to be freed by free() system call. If 'extralen' is not NULL, then on input it indicates number of extra bytes to allocate.
0023
0024 This is macro function and it invokes *CBgetalloc(3)* with field type *BFLD_STRING*.
0025
0026 RETURN VALUE
0027 ------------
0028 On success, *Bgetsa()* return pointer to memory block with data; on error, NULL is returned, with *Berror* set to indicate the error.
0029
0030 ERRORS
0031 ------
0032 Note that *Bstrerror()* returns generic error message plus custom message with debug info from last function call.
0033
0034 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0035
0036 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0037
0038 *BNOSPACE* No space in 'buf'.
0039
0040 *BMALLOC* Failed to allocate type conversion buffer.
0041
0042 *BBADFLD* Invalid field id passed.
0043
0044 *BNOTPRES* Field not present.
0045
0046 EXAMPLE
0047 -------
0048 See *ubftest/test_macro.c* for sample code.
0049
0050 BUGS
0051 ----
0052 Report bugs to support@mavimax.com
0053
0054 SEE ALSO
0055 --------
0056 *Bchg(3)* *Badd(3)* *CBadd(3)* *Bget(3)* *CBget(3)* *CBgetalloc(3)*
0057
0058 COPYING
0059 -------
0060 (C) Mavimax, Ltd
0061