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 *dest, const char *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
33       attributes(7).
34
35       ┌──────────┬───────────────┬─────────┐
36Interface Attribute     Value   
37       ├──────────┼───────────────┼─────────┤
38stpcpy()  │ Thread safety │ MT-Safe │
39       └──────────┴───────────────┴─────────┘

CONFORMING TO

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

BUGS

48       This function may overrun the buffer dest.
49

EXAMPLES

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

SEE ALSO

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

COLOPHON

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