User Tools

Site Tools


Sidebar

Table Of Contents

endurox:v7.5.x:api:ubf:bfprint.3

bfprint

Name

Bfprint — Print the buffer output in human readable form to specified io stream

Synopsis

#include <ubf.h>

int Bfprint (UBFH *p_ub, FILE *outf);

Link with -lubf -lnstd -lm -lpthread

DESCRIPTION

Function prints the p_ub buffer content to io stream at outf. The format of the output is "<FIELD><TAB><VALUE><NEW_LINE>". The BFLD_CARRAY fields are printed in the way that non readable characters are printed in hex-decimal format, prefixed with \. If value contains \ char, then it is printed as \\. Example:

T_SHORT_FLD     1765
T_LONG_FLD      3333111
T_LONG_FLD      2
T_CHAR_FLD      A
T_FLOAT_FLD     1.33000
T_DOUBLE_FLD    1111.220000
T_DOUBLE_FLD    333.000000
T_DOUBLE_FLD    444.000000
T_STRING_FLD    HELLO WORLD
T_CARRAY_FLD    \00\01\02\03HELLO BINARY\04\05\00

RETURN VALUE

On success, Bfprint() return zero; on error, -1 is returned, with Berror set to indicate the error.

ERRORS

Note that Bstrerror() returns generic error message plus custom message with debug info from last function call.

BALIGNERR Corrupted buffer or pointing to not aligned memory area.

BNOTFLD Buffer not fielded, not correctly allocated or corrupted.

BEINVAL outf is NULL.

EXAMPLE

See ubftest/test_print.c for sample code.

BUGS

Report bugs to support@mavimax.com

COPYING

© Mavimax, Ltd