]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/mempcpy.3
_syscall.2, shmget.2, stat.2, syscall.2, sysctl.2, utimensat.2, wait.2, CPU_SET.3...
[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 .B #include <string.h>
17 .PP
18 .BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n );
19
20 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
21 .B #include <wchar.h>
22 .PP
23 .BI "wchar_t *wmempcpy(wchar_t *" dest ", const wchar_t *" src ", size_t " n );
24 .fi
25 .SH DESCRIPTION
26 The
27 .BR mempcpy ()
28 function is nearly identical to the
29 .BR memcpy (3)
30 function.
31 It copies
32 .I n
33 bytes from the object beginning at
34 .I src
35 into the object pointed to by
36 .IR dest .
37 But instead of returning the value of
38 .I dest
39 it returns a pointer to the byte following the last written byte.
40 .PP
41 This function is useful in situations where a number of objects
42 shall be copied to consecutive memory positions.
43 .PP
44 The
45 .BR wmempcpy ()
46 function is identical but takes
47 .I wchar_t
48 type arguments and copies
49 .I n
50 wide characters.
51 .SH RETURN VALUE
52 .I dest
53 +
54 .IR n .
55 .SH VERSIONS
56 .BR mempcpy ()
57 first appeared in glibc in version 2.1.
58 .SH ATTRIBUTES
59 For an explanation of the terms used in this section, see
60 .BR attributes (7).
61 .TS
62 allbox;
63 lbw21 lb lb
64 l l l.
65 Interface Attribute Value
66 T{
67 .BR mempcpy (),
68 .BR wmempcpy ()
69 T} Thread safety MT-Safe
70 .TE
71 .SH CONFORMING TO
72 This function is a GNU extension.
73 .SH EXAMPLE
74 .EX
75 void *
76 combine(void *o1, size_t s1, void *o2, size_t s2)
77 {
78 void *result = malloc(s1 + s2);
79 if (result != NULL)
80 mempcpy(mempcpy(result, o1, s1), o2, s2);
81 return result;
82 }
83 .EE
84 .SH SEE ALSO
85 .BR memccpy (3),
86 .BR memcpy (3),
87 .BR memmove (3),
88 .BR wmemcpy (3)