strlcat [C++ Reference]
Keywords: c,string,strlcat
Date: 2009-01-28T08:05:58-0800

[[strlcat]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

## strlcat

Warning: Non-standard function!

Syntax:

        #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.

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •