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. If
18 the length strlen(src) is smaller than n, the remaining characters in
19 the array pointed to by dest are filled with '\0' characters. If the
20 length strlen(src) is greater or equal to n, the string pointed to by
21 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
38
39
40GNU 1999-07-25 STPNCPY(3)