Mantissify C API
Functions

Functions

int MANTISSIFY_value (double val, char *buf, const size_t len, const MANTISSIFY_OPT_t *opt)
 Formats a given measurement value into human friendly format.
int MANTISSIFY_text (const char *txt, char *buf, const size_t len, const MANTISSIFY_OPT_t *opt)
 Formats all measurement values within a given text into human friendly format.

Detailed Description

Function Documentation

◆ MANTISSIFY_text()

int MANTISSIFY_text ( const char * txt,
char * buf,
const size_t len,
const MANTISSIFY_OPT_t * opt )

Formats all measurement values within a given text into human friendly format.

Note that the function uses strtod from the C standard library, therefore the parser decimal point char depend on your locale setting.

Parameters
txtThe text to convert as pointer to a const c-string
bufPointer to a buffer for the formatted result text. Pass NULL to make a 'virtual' write (like snprintf).
lenLength (number of bytes) of the given buffer
optPointer to const struct with formatting options
Returns
The number of written bytes (excluding the c-string zero termination), also when writing virtual.

◆ MANTISSIFY_value()

int MANTISSIFY_value ( double val,
char * buf,
const size_t len,
const MANTISSIFY_OPT_t * opt )

Formats a given measurement value into human friendly format.

Note that the function uses snprintf from the C standard library, therefore the printed decimal point char my depend on your locale setting.

Parameters
fThe measurement value to format
bufPointer to a buffer for the formatted result text. Pass NULL to make a 'virtual' write (like snprintf).
lenLength (number of bytes) of the given buffer
optPointer to const struct with formatting options
Returns
The number of written bytes (excluding the c-string zero termination), also when writing virtual.