Next: strcasecmp, Previous: stpcpy, Up: Strings [Contents][Index]
stpncpy
—counted copy string returning a pointer to its endSynopsis
#include <string.h> char *stpncpy(char *restrict dst, const char *restrict src, size_t length);
Description
stpncpy
copies not more than length characters from the
the string pointed to by src (including the terminating
null character) to the array pointed to by dst. If the
string pointed to by src is shorter than length
characters, null characters are appended to the destination
array until a total of length characters have been
written.
Returns
This function returns a pointer to the end of the destination string,
thus pointing to the trailing ’\0’, or, if the destination string is
not null-terminated, pointing to dst + n.
Portability
stpncpy
is a GNU extension, candidate for inclusion into POSIX/SUSv4.
stpncpy
requires no supporting OS subroutines.