]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (c) Bruno Haible <haible@clisp.cons.org> |
2 | .\" | |
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. | |
7 | .\" | |
8 | .\" References consulted: | |
9 | .\" GNU glibc-2 source code and manual | |
10 | .\" | |
11 | .\" Corrected, aeb, 990824 | |
12 | .TH STPNCPY 3 1999-07-25 "GNU" "Linux Programmer's Manual" | |
13 | .SH NAME | |
14 | stpncpy \- copy a fixed-size string, returning a pointer to its end | |
15 | .SH SYNOPSIS | |
16 | .nf | |
17 | .B #define _GNU_SOURCE | |
18 | .br | |
19 | .B #include <string.h> | |
20 | .sp | |
21 | .BI "char *stpncpy(char *" dest ", const char *" src ", size_t " n ); | |
22 | .fi | |
23 | .SH DESCRIPTION | |
24 | The \fBstpncpy\fP function copies at most \fIn\fP characters from the string | |
25 | pointed to by \fIsrc\fP, including the terminating '\\0' character, to the | |
26 | array pointed to by \fIdest\fP. Exactly \fIn\fP characters are written at | |
27 | \fIdest\fP. If the length \fIstrlen(src)\fP is smaller than \fIn\fP, the | |
28 | remaining characters in the array pointed to by \fIdest\fP are filled | |
29 | with '\\0' characters. If the length \fIstrlen(src)\fP is greater or equal to | |
30 | \fIn\fP, the string pointed to by \fIdest\fP will not be '\\0' terminated. | |
31 | .PP | |
32 | The strings may not overlap. | |
33 | .PP | |
34 | The programmer must ensure that there is room for at least \fIn\fP characters | |
35 | at \fIdest\fP. | |
36 | .SH "RETURN VALUE" | |
37 | \fBstpncpy\fP returns a pointer to the terminating null | |
38 | in \fIdest\fP, or, if \fIdest\fP is not null-terminated, | |
39 | \fIdest + n\fP. | |
40 | .SH "CONFORMING TO" | |
41 | This function is a GNU extension. | |
42 | .SH "SEE ALSO" | |
43 | .BR strncpy (3) |