string¶
Small utilities to work with text.
-
struct string_t¶
[source] “String builder” without heap (
malloc()
,realloc()
,free
) usage.Code using this API would look similar to:
// create a stack-based buffer, 50bytes long string_t str = str_new(50); // add text to it str_append(&str, "Hello"); str_append(&str, " world"); // display it printf("%.*s\n", str.used, str.ptr);
-
size_t str_available(string_t str)¶
[source] Find out how many bytes in the buffer are left to be used.