String handle and its related functions.
◆ sg_str_new()
struct sg_str * sg_str_new |
( |
void |
| ) |
|
◆ sg_str_free()
void sg_str_free |
( |
struct sg_str * |
str | ) |
|
◆ sg_str_write()
int sg_str_write |
( |
struct sg_str * |
str, |
|
|
const char * |
val, |
|
|
size_t |
len |
|
) |
| |
Writes a null-terminated string to the string handle str
. All strings previously written are kept.
- Parameters
-
[in] | str | String handle. |
[in] | val | String to be written. |
[in] | len | Length of the string to be written. |
- Return values
-
0 | Success. |
EINVAL | Invalid argument. |
◆ sg_str_printf_va()
int sg_str_printf_va |
( |
struct sg_str * |
str, |
|
|
const char * |
fmt, |
|
|
va_list |
ap |
|
) |
| |
Prints a null-terminated formatted string from the argument list to the string handle str
.
- Parameters
-
[in] | str | String handle. |
[in] | fmt | Formatted string (following the same printf() format specification). |
[in] | ap | Arguments list (handled by va_start() / va_end() ). |
- Return values
-
0 | Success. |
EINVAL | Invalid argument. |
◆ sg_str_printf()
int sg_str_printf |
( |
struct sg_str * |
str, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
◆ sg_str_content()
int const char * sg_str_content |
( |
struct sg_str * |
str | ) |
|
◆ sg_str_length()
size_t sg_str_length |
( |
struct sg_str * |
str | ) |
|
Returns the total string length from the handle str
.
- Parameters
-
- Returns
- Total string length.
- Return values
-
◆ sg_str_clear()
int sg_str_clear |
( |
struct sg_str * |
str | ) |
|
Clears all existing content in the string handle str
.
- Parameters
-
- Return values
-
0 | Success. |
EINVAL | Invalid argument. |
- Examples
- example_httpuplds.c.