]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/stpcpy.3
ubstitute `//0' by '\\0'.
[thirdparty/man-pages.git] / man3 / stpcpy.3
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.
13 .\"
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.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .TH STPCPY 3 1995-09-03 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 stpcpy \- 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
37 The
38 .BR stpcpy ()
39 function copies the string pointed to by \fIsrc\fP
40 (including the terminating '\\0' character) to the array pointed to by
41 \fIdest\fP.
42 The strings may not overlap, and the destination string
43 \fIdest\fP must be large enough to receive the copy.
44 .SH "RETURN VALUE"
45 .BR stpcpy ()
46 returns a pointer to the \fBend\fP of the string
47 \fIdest\fP (that is, the address of the terminating null byte)
48 rather than the beginning.
49 .SH "CONFORMING TO"
50 This function is not part of the C or POSIX.1 standards, and is
51 not customary on Unix systems, but is not a GNU invention either.
52 Perhaps it comes from MS-DOS.
53 .SH EXAMPLE
54 For example, this program uses
55 .BR stpcpy ()
56 to concatenate \fBfoo\fP and
57 \fBbar\fP to produce \fBfoobar\fP, which it then prints.
58 .in +0.5i
59 .nf
60
61 #include <string.h>
62
63 int
64 main (void)
65 {
66 char *to = buffer;
67 to = stpcpy(to, "foo");
68 to = stpcpy(to, "bar");
69 printf("%s\\n", buffer);
70 }
71 .fi
72 .in
73 .SH "SEE ALSO"
74 .BR bcopy (3),
75 .BR memccpy (3),
76 .BR memcpy (3),
77 .BR memmove (3),
78 .BR strcpy (3),
79 .BR wcpcpy (3),
80 .BR feature_test_macros (7)