You copied the Doc URL to your clipboard.


Defined in string.h, the strlcat() function concatenates two strings.


extern size_t strlcat(char *dst, const char *src, size_t size);


strlcat() appends up to size-strlen(dst)-1 bytes from the NUL-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.