(ANSI Standard)
#include <string.h> ptr = strncpy( s1, s2, N );
"strncpy" copies at most N characters from the string "s2" into the area of memory pointed to by "s1". If it encounters a '\0' before it has copied N characters, it pads "s1" to N characters by adding '\0' characters. If "s2" is more than N-1 characters long, the first N characters will be copied and the string "s1" will NOT receive the usual terminating '\0'.
Copyright © 1996, Thinkage Ltd.