0001 BGETALLOC(3)
0002 ============
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bgetalloc - get the field value from buffer and copy it to newly allocated space
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 char * Bgetalloc (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC 'occ', BFLDLEN *'extralen');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Get the field 'bfldid' at 'occ' occurrence from 'p_ub' buffer. The value is
0023 returned (copied to) to memory block allocated by function. There is extra
0024 parameter 'extralen'. On input it indicates the additional space that shall be
0025 allocated, on output it indicates the data length loaded into allocated memory.
0026 The 'extralen' can be NULL, in that case no extra memory is allocated.
0027
0028 For *BFLD_VIEW* type fields, returned value points to allocated/initialized
0029 *BVIEWFLD* structure.
0030
0031 RETURN VALUE
0032 ------------
0033 On success, *Bgetalloc()* pointer to allocated memory block; on error, *NULL* is returned,
0034 with *Berror* set to indicate the error.
0035
0036 ERRORS
0037 ------
0038 Note that *Bstrerror()* returns generic error message plus custom message
0039 with debug info from last function call.
0040
0041 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0042
0043 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0044
0045 *BNOTPRES* Field not present.
0046
0047 *BMALLOC* Failed to allocate type conversion buffer.
0048
0049 *BBADFLD* Invalid field passed to 'bfldid'.
0050
0051 EXAMPLE
0052 -------
0053 See *ubftest/test_get.c* for sample code.
0054
0055 BUGS
0056 ----
0057 Report bugs to support@mavimax.com
0058
0059 SEE ALSO
0060 --------
0061 *Bchg(3)* *Badd(3)* *CBadd(3)* *Bfind(3)* *CBgetalloc(3)*
0062
0063 COPYING
0064 -------
0065 (C) Mavimax, Ltd
0066