Warning: Non-standard function!


    #include <string.h>  // On BSD or compatible systems
    size_t strlcat( char *dst, const char *src, size_t siz);

An attempt of the BSD people to “fix” strncat. There is a reason this function is not in any ISO standard. It is not a clear improvement over strncat, but rather an “overload” with different tradeoffs.

Original description:

Appends src to string dst of size siz (unlike strncat, siz is the full size of dst, not space left).
At most siz-1 characters will be copied.
Always NUL terminates (unless strlen(dst) > siz).
Returns strlen(src) + MIN(siz, strlen(initial dst))
If retval >= siz, truncation occurred.

Related Topics: memcpy, strchr, strncpy, strncat, strncmp

Another related (but non-standard) function is strlcpy.