SS8_COPY_TO_CSTR(3)              Ssstr Manual              SS8_COPY_TO_CSTR(3)



NAME
       ss8_copy_to_cstr,  ss8_copy_to_bytes  -  copy an ssstr byte string to a
       buffer

SYNOPSIS
       #include <ss8str.h>

       bool ss8_copy_to_cstr(ss8str const *restrict str,
                             char *restrict buf, size_t bufsize);
       bool ss8_copy_to_bytes(ss8str const *restrict str,
                             char *restrict buf, size_t bufsize);

DESCRIPTION
       ss8_copy_to_cstr() copies the contents of the ss8str at str to the buf‐
       fer located at buf, and appends a null byte.  At most bufsize bytes are
       written, including the null terminator; if bufsize is not sufficient to
       hold the string, the copied string is truncated at bufsize - 1 bytes.

       Behavior  is  undefined unless str is a valid ss8str object, buf points
       to a buffer of at least bufsize bytes that does not  overlap  with  the
       internal buffer of str, and bufsize is greater than or equal to 1.

       ss8_copy_to_bytes()  copies  the  contents  of the ss8str at str to the
       buffer located at buf.  No null terminator is appended.  At  most  buf‐
       size  bytes  are  written;  if  bufsize  is  not sufficient to hold the
       string, the copied string is truncated at bufsize bytes.

       Behavior is undefined unless str is  a  valid  ss8str  object  and  buf
       points to a buffer of at least bufsize bytes that does not overlap with
       the internal buffer of str.

RETURN VALUE
       ss8_copy_to_cstr() and ss8_copy_to_bytes() return true if the whole  of
       the string str was copied.  If the string had to be truncated, they re‐
       turn false.

SEE ALSO
       ss8_copy_bytes(3), ss8_copy_cstr(3), ssstr(7)



SSSTR                             2023-12-30               SS8_COPY_TO_CSTR(3)