]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/mempcpy.3
membarrier.2: Remove redundant mention of return value of MEMBARRIER_CMD_SHARED
[thirdparty/man-pages.git] / man3 / mempcpy.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
5 .\" %%%LICENSE_END
6 .\"
7 .\" Heavily based on glibc infopages, copyright Free Software Foundation
8 .\"
9 .\" aeb, 2003, polished a little
10 .TH MEMPCPY 3 2015-03-02 "GNU" "Linux Programmer's Manual"
11 .SH NAME
12 mempcpy, wmempcpy \- copy memory area
13 .SH SYNOPSIS
14 .nf
15 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
16 .br
17 .B #include <string.h>
18 .sp
19 .BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n );
20 .sp
21 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
22 .br
23 .B #include <wchar.h>
24 .sp
25 .BI "wchar_t *wmempcpy(wchar_t *" dest ", const wchar_t *" src ", size_t " n );
26 .fi
27 .SH DESCRIPTION
28 The
29 .BR mempcpy ()
30 function is nearly identical to the
31 .BR memcpy (3)
32 function.
33 It copies
34 .I n
35 bytes from the object beginning at
36 .I src
37 into the object pointed to by
38 .IR dest .
39 But instead of returning the value of
40 .I dest
41 it returns a pointer to the byte following the last written byte.
42 .PP
43 This function is useful in situations where a number of objects
44 shall be copied to consecutive memory positions.
45 .PP
46 The
47 .BR wmempcpy ()
48 function is identical but takes
49 .I wchar_t
50 type arguments and copies
51 .I n
52 wide characters.
53 .SH RETURN VALUE
54 .I dest
55 +
56 .IR n .
57 .SH VERSIONS
58 .BR mempcpy ()
59 first appeared in glibc in version 2.1.
60 .SH ATTRIBUTES
61 For an explanation of the terms used in this section, see
62 .BR attributes (7).
63 .TS
64 allbox;
65 lbw21 lb lb
66 l l l.
67 Interface Attribute Value
68 T{
69 .BR mempcpy (),
70 .BR wmempcpy ()
71 T} Thread safety MT-Safe
72 .TE
73 .SH CONFORMING TO
74 This function is a GNU extension.
75 .SH EXAMPLE
76 .nf
77 void *
78 combine(void *o1, size_t s1, void *o2, size_t s2)
79 {
80 void *result = malloc(s1 + s2);
81 if (result != NULL)
82 mempcpy(mempcpy(result, o1, s1), o2, s2);
83 return result;
84 }
85 .fi
86 .SH SEE ALSO
87 .BR memccpy (3),
88 .BR memcpy (3),
89 .BR memmove (3),
90 .BR wmemcpy (3)