7.23.2.4 The strncpy function
Synopsis
#include <string.h>
char *strncpy(char * restrict s1, const char * restrict s2, size_t n);
Description
The strncpy function copies not more than n characters (characters that follow a null character are not copied) from the array pointed to by s2 to the array pointed to by s1.
If copying takes place between objects that overlap, the behavior is undefined.
If the array pointed to by s2 is a string that is shorter than n characters, null characters are appended to the copy in the array pointed to by s1, until n characters in all have been written.
Returns
he strncpy function returns the value of s1.
⇒ source
ISO C 11 manual
Partager