strncpy

C/C++ Reference

strncpy
Syntax:
  #include <cstring>
  char *strncpy( char *to, const char *from, size_t count );

The strncpy() function copies at most count characters of from to the string to. If from has less than count characters, the remainder is padded with '\0' characters. The return value is the resulting string.

Related topics:

Another set of related (but non-standard) functions are strlcpy and strlcat.