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 2021-03-22 "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 *restrict " dest ", const char *restrict " src );
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
43 _POSIX_C_SOURCE >= 200809L
50 function copies the string pointed to by
52 (including the terminating null byte (\(aq\e0\(aq)) to the array pointed to by
54 The strings may not overlap, and the destination string
56 must be large enough to receive the copy.
59 returns a pointer to the
63 (that is, the address of the terminating null byte)
64 rather than the beginning.
66 For an explanation of the terms used in this section, see
74 Interface Attribute Value
77 T} Thread safety MT-Safe
83 This function was added to POSIX.1-2008.
84 Before that, it was not part of
85 the C or POSIX.1 standards, nor customary on UNIX systems.
86 It first appeared at least as early as 1986,
87 in the Lattice C AmigaDOS compiler,
88 then in the GNU fileutils and GNU textutils in 1989,
89 and in the GNU C library by 1992.
90 It is also present on the BSDs.
92 This function may overrun the buffer
95 For example, this program uses
103 which it then prints.
116 to = stpcpy(to, "foo");
117 to = stpcpy(to, "bar");
118 printf("%s\en", buffer);