Macros | Functions | Variables
format.h File Reference

Printing different types as string. More...

Macros

#define VTM_FMT_CHARS_INT32   11
 
#define VTM_FMT_CHARS_INT64   20
 
#define VTM_FMT_CHARS_HEX_SIZE   16
 

Functions

VTM_API unsigned int vtm_fmt_int (char *dst, int val)
 
VTM_API unsigned int vtm_fmt_uint (char *dst, unsigned int val)
 
VTM_API unsigned int vtm_fmt_int64 (char *dst, int64_t val)
 
VTM_API unsigned int vtm_fmt_uint64 (char *dst, uint64_t val)
 
VTM_API unsigned int vtm_fmt_hex_size (char *dst, size_t val)
 
VTM_API unsigned int vtm_fmt_hex_mem (char *dst, const unsigned char *src, size_t len, bool ucase)
 

Variables

VTM_API const char VTM_HEX_CHARS []
 
VTM_API const char VTM_HEX_LCHARS []
 

Macro Definition Documentation

#define VTM_FMT_CHARS_INT32   11

Maximum needed buffer size for storing a 32 bit integer value as string

#define VTM_FMT_CHARS_INT64   20

Maximum needed buffer size for storing a 64 bit integer value as string

#define VTM_FMT_CHARS_HEX_SIZE   16

Maximum needed buffer size for storing a 64 bit size_t value as hex-string

Function Documentation

VTM_API unsigned int vtm_fmt_int ( char *  dst,
int  val 
)

Print string representation of signed integer.

Parameters
dstthe destination where the string is written to, can be NULL
valthe value that should be printed
Returns
the number of characters used to represent the number
VTM_API unsigned int vtm_fmt_uint ( char *  dst,
unsigned int  val 
)

Print string representation of unsigned integer.

Parameters
dstthe destination where the string is written to, can be NULL
valthe value that should be printed
Returns
the number of characters used to represent the number
VTM_API unsigned int vtm_fmt_int64 ( char *  dst,
int64_t  val 
)

Print string representation of signed 64 bit integer.

Parameters
dstthe destination where the string is written to, can be NULL
valthe value that should be printed
Returns
the number of characters used to represent the number
VTM_API unsigned int vtm_fmt_uint64 ( char *  dst,
uint64_t  val 
)

Print string representation of unsigned 64 bit integer.

Parameters
dstthe destination where the string is written to, can be NULL
valthe value that should be printed
Returns
the number of characters used to represent the number
VTM_API unsigned int vtm_fmt_hex_size ( char *  dst,
size_t  val 
)

Print hex-string representation of size_t value.

Parameters
dstthe destination where the string is written to, can be NULL
valthe value that should be printed
Returns
the number of characters used by the hex-string
VTM_API unsigned int vtm_fmt_hex_mem ( char *  dst,
const unsigned char *  src,
size_t  len,
bool  ucase 
)

Print hex-string representation of a memory chunk.

Parameters
dstthe destination where the string is written to, can be NULL
srcpointer to memory chunk
lenlength of memory chunk in bytes
ucasetrue if uppercase hex letters should be used
Returns
the number of characters used by the hex-string

Variable Documentation

VTM_API const char VTM_HEX_CHARS[]

Uppercase hex chars

VTM_API const char VTM_HEX_LCHARS[]

Lowercase hex chars