0001 BCHGS(3)
0002 ========
0003 :doctype: manpage
0004
0005
0006 NAME
0007 ----
0008 Bchgs - Change (add or update) field occurrance in UBF buffer by given string value
0009
0010
0011 SYNOPSIS
0012 --------
0013
0014 #include <ubf.h>
0015
0016 int Bchgs (UBFH *'p_ub', BFLDID 'bfldid', BFLDOCC 'occ', char *'buf');
0017
0018 Link with '-lubf -lnstd -lm -lpthread'
0019
0020 DESCRIPTION
0021 -----------
0022 Change (add or update) field in UBF buffer by given user string value. The UBF buffer pointer is passed by 'p_ub', field id in 'bfldid'. 'occ' is occurrance to change. The string field value is passed in 'buf'. 'buf' is automatically converted to corresponding field type.
0023
0024 If 'occ' is bigger than last existing index+1 in buffer then non existing occurrences (which are not being set directly by this function) are initialised with defaults. For numerics it is 0, for *BFLD_CHAR* it is 0x00, for *BFLD_STRING* it is empty string, for *BFLD_CARRAY* it is empty byte array (with length 0).
0025
0026 Bchgs() basically is the same as *CBchgs(3)* passed in with *BFLD_STRING* type.
0027
0028
0029 RETURN VALUE
0030 ------------
0031 On success, *Bchgs()* return zero; on error, -1 is returned, with *Berror* set to indicate the error.
0032
0033 ERRORS
0034 ------
0035 Note that *Bstrerror()* returns generic error message plus custom message with debug info from last function call.
0036
0037 *BALIGNERR* Corrupted buffer or pointing to not aligned memory area.
0038
0039 *BNOTFLD* Buffer not fielded, not correctly allocated or corrupted.
0040
0041 *BNOSPACE* No space in buffer for string data.
0042
0043 *BBADFLD* Invalid field id passed.
0044
0045 *BMALLOC* Failed to allocate type conversion buffer.
0046
0047 EXAMPLE
0048 -------
0049 See *ubftest/test_macro.c* for sample code.
0050
0051 BUGS
0052 ----
0053 Report bugs to support@mavimax.com
0054
0055 SEE ALSO
0056 --------
0057 *CBchg(3)* *Badd(3)* *CBadd(3)* *Bget(3)* *CBget(3)*
0058
0059 COPYING
0060 -------
0061 (C) Mavimax, Ltd
0062