Functions | |
const cxchar * | cx_program_get_name (void) |
Get the name of the application. | |
void | cx_program_set_name (const cxchar *name) |
Set the name of the application. | |
cxint | cx_bits_find (cxuint32 mask, cxint start) |
Get the position of the first bit set, searching from left to right. | |
cxint | cx_bits_rfind (cxuint32 mask, cxint start) |
Get the position of the first bit set, searching from right to left. | |
cxint | cx_snprintf (cxchar *string, cxsize n, const cxchar *format,...) |
Safe version of sprintf(). | |
cxint | cx_vsnprintf (cxchar *string, cxsize n, const cxchar *format, va_list args) |
Safe version of vsprintf(). | |
cxint | cx_asprintf (cxchar **string, const cxchar *format,...) |
Write formatted output to a newly allocated string. | |
cxint | cx_vasprintf (cxchar **string, const cxchar *format, va_list args) |
Write formatted output to a newly allocated string with a variable-length argument list. | |
cxlong | cx_line_max (void) |
Get the maximum length of a line supported by the system. | |
cxchar * | cx_line_alloc (void) |
Allocate a line buffer with the maximum size supported by the system. |
#include <cxutils.h>
cxint cx_asprintf | ( | cxchar ** | string, | |
const cxchar * | format, | |||
... | ||||
) |
Write formatted output to a newly allocated string.
string | Address where the allocated string is stored. | |
format | The format string. | |
... | Arguments to be inserted into the format string. |
The pointer to the allocated string buffer sufficiently large to hold the string is returned to the caller in the string argument. This pointer should be passed to cx_free to release the allocated storage when it is no longer needed. If sufficient memory cannot be allocated is set to NULL
.
cxint cx_bits_find | ( | cxuint32 | mask, | |
cxint | start | |||
) |
Get the position of the first bit set, searching from left to right.
mask | A 32 bit integer containing bit flags. | |
start | Bit position where the search starts. |
cxint cx_bits_rfind | ( | cxuint32 | mask, | |
cxint | start | |||
) |
Get the position of the first bit set, searching from right to left.
mask | A 32 bit integer containing bit flags. | |
start | Bit position where the search starts. |
cxchar* cx_line_alloc | ( | void | ) |
Allocate a line buffer with the maximum size supported by the system.
cxlong cx_line_max | ( | void | ) |
Get the maximum length of a line supported by the system.
const cxchar* cx_program_get_name | ( | void | ) |
Get the name of the application.
void cx_program_set_name | ( | const cxchar * | name | ) |
Set the name of the application.
name | The program name. |
cxint cx_snprintf | ( | cxchar * | string, | |
cxsize | n, | |||
const cxchar * | format, | |||
... | ||||
) |
Safe version of sprintf().
string | Destination string. | |
n | Maximum number of characters to be written. | |
format | The format string. | |
... | Arguments to be inserted into the format string. |
The difference compared to sprintf() is that the produced number of characters does not exceed n (including the trailing null).
cxint cx_vasprintf | ( | cxchar ** | string, | |
const cxchar * | format, | |||
va_list | args | |||
) |
Write formatted output to a newly allocated string with a variable-length argument list.
string | Address where the allocated string is stored. | |
format | The format string. | |
args | List of arguments to be inserted into the format string. |
The pointer to the allocated string buffer sufficiently large to hold the string is returned to the caller in the string argument. This pointer should be passed to cx_free to release the allocated storage when it is no longer needed. If sufficient memory cannot be allocated is set to NULL
.
cxint cx_vsnprintf | ( | cxchar * | string, | |
cxsize | n, | |||
const cxchar * | format, | |||
va_list | args | |||
) |
Safe version of vsprintf().
string | Destination string. | |
n | Maximum number of characters to be written. | |
format | The format string. | |
args | List of arguments to be inserted into the format string. |
The difference compared to vsprintf() is that the produced number of characters does not exceed n (including the trailing null).