1STPCPY(3)                  Linux Programmer's Manual                 STPCPY(3)
2
3
4

NAME

6       stpcpy - copy a string returning a pointer to its end
7

SYNOPSIS

9       #include <string.h>
10
11       char *stpcpy(char *restrict dest, const char *restrict src);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       stpcpy():
16           Since glibc 2.10:
17               _POSIX_C_SOURCE >= 200809L
18           Before glibc 2.10:
19               _GNU_SOURCE
20

DESCRIPTION

22       The  stpcpy()  function  copies the string pointed to by src (including
23       the terminating null byte ('\0')) to the array pointed to by dest.  The
24       strings  may not overlap, and the destination string dest must be large
25       enough to receive the copy.
26

RETURN VALUE

28       stpcpy() returns a pointer to the end of the string dest (that is,  the
29       address of the terminating null byte) rather than the beginning.
30

ATTRIBUTES

32       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
33       tributes(7).
34
35       ┌────────────────────────────────────────────┬───────────────┬─────────┐
36Interface                                   Attribute     Value   
37       ├────────────────────────────────────────────┼───────────────┼─────────┤
38stpcpy()                                    │ Thread safety │ MT-Safe │
39       └────────────────────────────────────────────┴───────────────┴─────────┘
40

CONFORMING TO

42       This function was added to POSIX.1-2008.  Before that, it was not  part
43       of the C or POSIX.1 standards, nor customary on UNIX systems.  It first
44       appeared at least as early as 1986, in the Lattice C AmigaDOS compiler,
45       then  in  the GNU fileutils and GNU textutils in 1989, and in the GNU C
46       library by 1992.  It is also present on the BSDs.
47

BUGS

49       This function may overrun the buffer dest.
50

EXAMPLES

52       For example, this program uses stpcpy() to concatenate foo and  bar  to
53       produce foobar, which it then prints.
54
55       #define _GNU_SOURCE
56       #include <string.h>
57       #include <stdio.h>
58
59       int
60       main(void)
61       {
62           char buffer[20];
63           char *to = buffer;
64
65           to = stpcpy(to, "foo");
66           to = stpcpy(to, "bar");
67           printf("%s\n", buffer);
68       }
69

SEE ALSO

71       bcopy(3),  memccpy(3),  memcpy(3),  memmove(3),  stpncpy(3), strcpy(3),
72       string(3), wcpcpy(3)
73

COLOPHON

75       This page is part of release 5.13 of the Linux  man-pages  project.   A
76       description  of  the project, information about reporting bugs, and the
77       latest    version    of    this    page,    can     be     found     at
78       https://www.kernel.org/doc/man-pages/.
79
80
81
82GNU                               2021-03-22                         STPCPY(3)
Impressum