Next: , Previous: Autostr concatenation, Up: Automatic strings


10.6 Inserting into an automatic string

— Function: int astr_insert (Autostr *dest, ssize_t index, const Autostr *src)

Inserts a copy of the contents of src into dest at position index. index must be non-negative and no greater than the length of dest. Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int astr_insert_s (Autostr *astr, ssize_t index, const char *chars)

Inserts a copy of the characters referenced by chars into astr at position index. index must be non-negative and no greater than the length of dest. Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int astr_insert_c (Autostr *astr, ssize_t index, int c)

Inserts c (converted to a ‘char’) into astr at position index. c may not be zero. index must be non-negative and no greater than the length of dest. Returns 0 if the function succeeded, or -1 if there was insufficient memory.