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       #define _GNU_SOURCE
10       #include <string.h>
11
12       char *stpcpy(char *dest, const char *src);
13

DESCRIPTION

15       The  stpcpy()  function  copies the string pointed to by src (including
16       the terminating '\0' character) to the array pointed to by  dest.   The
17       strings  may not overlap, and the destination string dest must be large
18       enough to receive the copy.
19

RETURN VALUE

21       stpcpy() returns a pointer to the end of the string dest (that is,  the
22       address of the terminating null byte) rather than the beginning.
23

CONFORMING TO

25       This  function  is  not  part of the C or POSIX.1 standards, and is not
26       customary on Unix systems, but is not a GNU invention either.   Perhaps
27       it comes from MS-DOS.  Nowadays, it is also present on the BSDs.
28

EXAMPLE

30       For  example,  this program uses stpcpy() to concatenate foo and bar to
31       produce foobar, which it then prints.
32
33           #define _GNU_SOURCE
34           #include <string.h>
35           #include <stdio.h>
36
37           int
38           main(void)
39           {
40               char buffer[20];
41               char *to = buffer;
42
43               to = stpcpy(to, "foo");
44               to = stpcpy(to, "bar");
45               printf("%s\n", buffer);
46           }
47

BUGS

49       This function may overrun the buffer dest.
50

SEE ALSO

52       bcopy(3), memccpy(3), memcpy(3), memmove(3), strcpy(3), wcpcpy(3), fea‐
53       ture_test_macros(7)
54

COLOPHON

56       This  page  is  part of release 3.22 of the Linux man-pages project.  A
57       description of the project, and information about reporting  bugs,  can
58       be found at http://www.kernel.org/doc/man-pages/.
59
60
61
62GNU                               2009-02-04                         STPCPY(3)
Impressum