0001 CBGETALLOC(3)
0002 =============
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 CBgetalloc - get the field value from buffer and copy it to newly allocated space, converted to user type
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 char * CBgetalloc (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC 'occ', int 'usrtype', 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 converted to 'usrtype'. The value is returned (copied to) to memory block allocated
0024 by function. There is extra parameter 'extralen'. On input it indicates the
0025 additional space that shall be allocated. The 'extralen' can be NULL, in that
0026 case no extra memory is allocated.
0027
0028 Function is based on *Bgetalloc(3)*, which does not convert to user type,
0029 but returns direct value.
0030
0031 Function operations on field types *BFLD_UBF* and *BFLD_VIEW*
0032 are not supported. This includes type of 'bfldid' or 'usrtype' having any
0033 unsupported field types for this function.
0034
0035 RETURN VALUE
0036 ------------
0037 On success, *CBgetalloc()* return zero; on error, -1 is returned,
0038 with *Berror* set to indicate the error.
0039
0040 ERRORS
0041 ------
0042 Note that *Bstrerror()* returns generic error message plus custom message
0043 with debug info from last function call.
0044
0045 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0046
0047 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0048
0049 *BNOTPRES* Field not present.
0050
0051 *BMALLOC* Failed to allocate type conversion buffer.
0052
0053 *BBADFLD* Invalid field passed to 'bfldid'.
0054
0055 *BTYPERR* Invalid user type specified.
0056
0057 *BEBADOP* Operation not supported (e.g. work with *BFLD_UBF*
0058 or *BFLD_VIEW* type fields).
0059
0060 EXAMPLE
0061 -------
0062 See *ubftest/test_get.c* for sample code.
0063
0064 BUGS
0065 ----
0066 Report bugs to support@mavimax.com
0067
0068 SEE ALSO
0069 --------
0070 *Bchg(3)* *Badd(3)* *CBadd(3)* *Bfind(3)* *Bgetalloc(3)*
0071
0072 COPYING
0073 -------
0074 (C) Mavimax, Ltd
0075