1 .\" Copyright 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
3 .\" %%%LICENSE_START(verbatim)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH STPCPY 3 2012-03-15 "GNU" "Linux Programmer's Manual"
27 stpcpy \- copy a string returning a pointer to its end
30 .B #include <string.h>
32 .BI "char *stpcpy(char *" dest ", const char *" src );
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
46 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
56 function copies the string pointed to by \fIsrc\fP
57 (including the terminating null byte (\(aq\\0\(aq)) to the array pointed to by
59 The strings may not overlap, and the destination string
60 \fIdest\fP must be large enough to receive the copy.
63 returns a pointer to the \fBend\fP of the string
64 \fIdest\fP (that is, the address of the terminating null byte)
65 rather than the beginning.
67 This function was added to POSIX.1-2008. Before that, it was not part of
68 the C or POSIX.1 standards, nor customary on UNIX systems, but was not a
70 Perhaps it came from MS-DOS.
71 It is also present on the BSDs.
73 This function may overrun the buffer
76 For example, this program uses
78 to concatenate \fBfoo\fP and
79 \fBbar\fP to produce \fBfoobar\fP, which it then prints.
93 to = stpcpy(to, "foo");
94 to = stpcpy(to, "bar");
95 printf("%s\\n", buffer);