Next: , Previous: Autobuf status, Up: Automatic buffers


11.4 Copying into an autobuf

— Function: int abuf_set (Autobuf *abuf, ssize_t n, int c)

Makes abuf contain exactly n occurrences of c (converted to an ‘unsigned char’). Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int abuf_copy (Autobuf *dest, const Autobuf *src)

Sets the contents of dest to be a copy of the contents of src. Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int abuf_copy_buf (Autobuf *abuf, const unsigned char *buf, ssize_t len)

Sets the contents of abuf to be a copy of the len bytes stored at buf. len may not be negative. Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int abuf_copy_astr (Autobuf *abuf, const Autostr *astr)

Sets the contents of abuf to be a copy of the contents of astr (excluding the terminating null byte). Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int abuf_copy_s (Autobuf *abuf, const char *chars)

Sets the contents of abuf to be a copy of the characters referenced by chars. Returns 0 if the function succeeded, or -1 if there was insufficient memory.

— Function: int abuf_copy_c (Autobuf *abuf, int c)

Sets the contents of abuf to be c (converted to an ‘unsigned char’). Returns 0 if the function succeeded, or -1 if there was insufficient memory.