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 #include <string.h>
10
11 char *stpncpy(char *dest, const char *src, size_t n);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 stpncpy():
16 Since glibc 2.10:
17 _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
18 Before glibc 2.10:
19 _GNU_SOURCE
20
22 The stpncpy() function copies at most n characters from the string
23 pointed to by src, including the terminating null byte ('\0'), to the
24 array pointed to by dest. Exactly n characters are written at dest.
25 If the length strlen(src) is smaller than n, the remaining characters
26 in the array pointed to by dest are filled with null bytes ('\0'), If
27 the length strlen(src) is greater or equal to n, the string pointed to
28 by dest will not be null-terminated.
29
30 The strings may not overlap.
31
32 The programmer must ensure that there is room for at least n characters
33 at dest.
34
36 stpncpy() returns a pointer to the terminating null byte in dest, or,
37 if dest is not null-terminated, dest + n.
38
40 This function was added to POSIX.1-2008. Before that, it was a GNU
41 extension.
42
44 strncpy(3), wcpncpy(3)
45
47 This page is part of release 3.53 of the Linux man-pages project. A
48 description of the project, and information about reporting bugs, can
49 be found at http://www.kernel.org/doc/man-pages/.
50
51
52
53GNU 2011-09-28 STPNCPY(3)