| |||
| Home > The C and C++ libraries > strlcat() | |||
Defined in string.h, this function concatenates
two strings. It appends up to bytes
from the size-strlen(dst)-1NUL-terminated string src to
the end of dst. It takes the full size
of the buffer, not only the length, and terminates the result with NUL as
long as size is greater than 0. Include
a byte for the NUL in your size value.
The strlcat() function returns the total
length of the string that would have been created
if there was unlimited space. This might or might not be equal to
the length of the string actually created,
depending on whether there was enough space. This means that you
can call strlcat() once to find out how much
space is required, then allocate it if you do not have enough, and finally
call strlcat() a second time to create the
required string.
This function is a common BSD-derived extension to many C libraries.