strncpy(dst, src, len)

When the src's length is smaller than len, the remaining part of dst will be '\0'.
When the src's length is larger than len, the dst will not contain '\0'.

strlcpy(dst, src, len)

Copy src to string dst of size siz. At most siz-1 characters will be copied. Always NUL terminates (unless siz == 0). Returns strlen(src); if retval >= siz, truncation occurred.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License