1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
11 .\" Corrected, aeb, 990824
12 .TH STPNCPY 3 2011-09-28 "GNU" "Linux Programmer's Manual"
14 stpncpy \- copy a fixed-size string, returning a pointer to its end
17 .B #include <string.h>
19 .BI "char *stpncpy(char *" dest ", const char *" src ", size_t " n );
23 Feature Test Macro Requirements for glibc (see
24 .BR feature_test_macros (7)):
33 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
43 function copies at most \fIn\fP characters from the string
44 pointed to by \fIsrc\fP, including the terminating null byte (\(aq\\0\(aq),
45 to the array pointed to by \fIdest\fP.
46 Exactly \fIn\fP characters are written at
48 If the length \fIstrlen(src)\fP is smaller than \fIn\fP, the
49 remaining characters in the array pointed to by \fIdest\fP are filled
50 with null bytes (\(aq\\0\(aq),
51 If the length \fIstrlen(src)\fP is greater or equal to
52 \fIn\fP, the string pointed to by \fIdest\fP will
53 not be null-terminated.
55 The strings may not overlap.
57 The programmer must ensure that there is room for at least \fIn\fP characters
61 returns a pointer to the terminating null byte
62 in \fIdest\fP, or, if \fIdest\fP is not null-terminated,
65 This function was added to POSIX.1-2008. Before that, it was a GNU extension.