]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/stpcpy.3
stpcpy.3: wspfix
[thirdparty/man-pages.git] / man3 / stpcpy.3
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" Copyright 1995 James R. Van Zandt <jrv@vanzandt.mv.com>
4.\"
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
c13182ef 13.\"
fea681da
MK
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
c13182ef 21.\"
fea681da
MK
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
24.\"
822002bd 25.TH STPCPY 3 2009-02-04 "GNU" "Linux Programmer's Manual"
fea681da
MK
26.SH NAME
27stpcpy \- copy a string returning a pointer to its end
28.SH SYNOPSIS
29.nf
30.B #define _GNU_SOURCE
31.br
32.B #include <string.h>
33.sp
34.BI "char *stpcpy(char *" dest ", const char *" src );
35.fi
36.SH DESCRIPTION
60a90ecd
MK
37The
38.BR stpcpy ()
39function copies the string pointed to by \fIsrc\fP
f81fb444 40(including the terminating \(aq\\0\(aq character) to the array pointed to by
1c44bd5b
MK
41\fIdest\fP.
42The strings may not overlap, and the destination string
fea681da
MK
43\fIdest\fP must be large enough to receive the copy.
44.SH "RETURN VALUE"
60a90ecd
MK
45.BR stpcpy ()
46returns a pointer to the \fBend\fP of the string
28d88c17 47\fIdest\fP (that is, the address of the terminating null byte)
fea681da 48rather than the beginning.
2b2581ee
MK
49.SH "CONFORMING TO"
50This function is not part of the C or POSIX.1 standards, and is
51not customary on Unix systems, but is not a GNU invention either.
52Perhaps it comes from MS-DOS.
822002bd 53Nowadays, it is also present on the BSDs.
fea681da 54.SH EXAMPLE
60a90ecd
MK
55For example, this program uses
56.BR stpcpy ()
57to concatenate \fBfoo\fP and
fea681da 58\fBbar\fP to produce \fBfoobar\fP, which it then prints.
088a639b 59.in +4n
fea681da
MK
60.nf
61
2b2581ee 62#include <string.h>
fea681da 63
2b2581ee 64int
b6898014 65main(void)
2b2581ee
MK
66{
67 char *to = buffer;
68 to = stpcpy(to, "foo");
69 to = stpcpy(to, "bar");
70 printf("%s\\n", buffer);
71}
fea681da 72.fi
2b2581ee 73.in
fea681da
MK
74.SH "SEE ALSO"
75.BR bcopy (3),
76.BR memccpy (3),
77.BR memcpy (3),
78.BR memmove (3),
1709027c 79.BR strcpy (3),
0a90178c
MK
80.BR wcpcpy (3),
81.BR feature_test_macros (7)