High Performance OPC UA Server SDK
1.2.0.193
|
String utility functions. More...
Functions | |
size_t | util_strlcpy (char *dst, const char *src, size_t len) |
Size limited copy string function. More... | |
size_t | util_strlcat (char *dst, const char *src, size_t len) |
Size limited concatenate string function. More... | |
int | util_snprintf (char *str, size_t size, const char *format,...) |
Like snprintf(), but returns errorcode also on truncation. More... | |
void | util_print_aligned (char *line, size_t size, const char *left, char fillchar, const char *fmt,...) |
Special helper function for printing aligned text. More... | |
String utility functions.
int void util_print_aligned | ( | char * | line, |
size_t | size, | ||
const char * | left, | ||
char | fillchar, | ||
const char * | fmt, | ||
... | |||
) |
Special helper function for printing aligned text.
Format: "left aligned text.........right aligned text"
line | buffer to print to |
size | size of line in bytes |
left | left text which is a kind of label |
fillchar | a character used to fill the gap to the right text |
fmt | format specifier of right side text |
int util_snprintf | ( | char * | str, |
size_t | size, | ||
const char * | format, | ||
... | |||
) |
Like snprintf(), but returns errorcode also on truncation.
This function works similar to the original snprintf, except that it returns a negative errorcode in case of failure. For most error the universal errocodeo UA_EBAD is returned. If an argument is NULL respectively 0 UA_EBADINVALIDARGUMENT is returned. In case of truncation either UA_EBADTRUNCATED or UA_EBAD is returned depending on the platform. If str is NULL and size is 0, the number of bytes that would have been written is returned or a negative errorcode on failure.
str | Preallocated string to write output to. |
size | Maximum number of bytes written to str including terminating null byte. |
format | As specified by snprintf(). |
size_t util_strlcat | ( | char * | dst, |
const char * | src, | ||
size_t | len | ||
) |
Size limited concatenate string function.
This function guaranties that dst
will be zero terminated, as long as dst
is at least one byte long. Note that strlcat works on true 'C' strings, which means both src
and dst
must be zero terminated. If len
<= strlen(dst) strlcat cannot write any characters, strlen(dst) will be returned.
dst | destination buffer |
src | source buffer |
len | length of destination |
dst
size_t util_strlcpy | ( | char * | dst, |
const char * | src, | ||
size_t | len | ||
) |
Size limited copy string function.
This function guaranties that dst
will be zero terminated, as long as dst
is at least one byte long. Note that strlcpy works on true 'C' strings, which means both src
and dst
must be zero terminated.
dst | destination buffer |
src | source buffer |
len | length of destination |
dst