C Collections

cstring · Section 3

cstring_set

cstring_set - replace the entire content with a new C string

C Collections (libccollections, -lccollections)

#include <ccollections/cstring.h>
 
ccol_retval cstring_set(cstr s, const char *str);

This function throws away the current content of s and puts a copy of str
in its place. It grows the buffer when it has to, but it never shrinks
it.

s     String to change
str   New content (must not be NULL)

ccol_success              - The set succeeded
ccol_invalid_args         - str is NULL
ccol_container_full       - str is too large to represent. No real
                            program gets this code, since such a str
                            would need the whole address space
ccol_not_enough_memory    - The reallocation failed

Asserts if s is NULL

cstring_reset(3), cstring_append(3)