strncpy - copy part of a string
#include <string.h> char *strncpy(char *s1, const char *s2, size_t n);
The strncpy() function copies not more than n bytes (bytes that follow a null byte 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 behaviour is undefined.
If the array pointed to by s2 is a string that is shorter than n bytes, null bytes are appended to the copy in the array pointed to by s1, until n bytes in all are written.
The strncpy() function returns s1; no return value is reserved to indicate an error.
No errors are defined.
Character movement is performed differently in different implementations. Thus overlapping moves may yield surprises.
If there is no null byte in the first n bytes of the array pointed to by s2, the result will not be null-terminated.
Derived from Issue 1 of the SVID.