errno_t strncpy_s(char *restrict s1, size_t s1max, const char *restrict s2, rsize_t n);
strncpy_s copies not more than n characters the string pointed to by s2 (including the terminating null character) into the array pointed to by s1 whose size is supplied in s1max. The parameters are checked for null pointer and overlapping cases. On error strncpy_s stores null in the first element of s1 and the current constraint_handler is called.
strncpy_s returns 0 on success and non-zero on failure.