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               _XOPEN_SOURCE >= 700 || _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

CONFORMING TO

32       This  function was added to POSIX.1-2008.  Before that, it was not part
33       of the C or POSIX.1 standards, nor customary on UNIX systems,  but  was
34       not  a  GNU invention either.  Perhaps it came from MS-DOS.  It is also
35       present on the BSDs.
36

BUGS

38       This function may overrun the buffer dest.
39

EXAMPLE

41       For example, this program uses stpcpy() to concatenate foo and  bar  to
42       produce foobar, which it then prints.
43
44           #define _GNU_SOURCE
45           #include <string.h>
46           #include <stdio.h>
47
48           int
49           main(void)
50           {
51               char buffer[20];
52               char *to = buffer;
53
54               to = stpcpy(to, "foo");
55               to = stpcpy(to, "bar");
56               printf("%s\n", buffer);
57           }
58

SEE ALSO

60       bcopy(3),  memccpy(3),  memcpy(3),  memmove(3),  stpncpy(3), strcpy(3),
61       string(3), wcpcpy(3)
62

COLOPHON

64       This page is part of release 3.53 of the Linux  man-pages  project.   A
65       description  of  the project, and information about reporting bugs, can
66       be found at http://www.kernel.org/doc/man-pages/.
67
68
69
70GNU                               2012-03-15                         STPCPY(3)
Impressum