1STPNCPY(3) Linux Programmer's Manual STPNCPY(3)
2
3
4
6 stpncpy - copy a fixed-size string, returning a pointer to its end
7
9 #define _GNU_SOURCE
10 #include <string.h>
11
12 char *stpncpy(char *dest, const char *src, size_t n);
13
15 The stpncpy() function copies at most n characters from the string
16 pointed to by src, including the terminating '\0' character, to the
17 array pointed to by dest. Exactly n characters are written at dest.
18 If the length strlen(src) is smaller than n, the remaining characters
19 in the array pointed to by dest are filled with '\0' characters. If
20 the length strlen(src) is greater or equal to n, the string pointed to
21 by dest will not be '\0' terminated.
22
23 The strings may not overlap.
24
25 The programmer must ensure that there is room for at least n characters
26 at dest.
27
29 stpncpy() returns a pointer to the terminating null in dest, or, if
30 dest is not null-terminated, dest + n.
31
33 This function is a GNU extension.
34
36 strncpy(3), wcpncpy(3), feature_test_macros(7)
37
39 This page is part of release 3.25 of the Linux man-pages project. A
40 description of the project, and information about reporting bugs, can
41 be found at http://www.kernel.org/doc/man-pages/.
42
43
44
45GNU 1999-07-25 STPNCPY(3)