]>
Commit | Line | Data |
---|---|---|
fea681da | 1 | .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de) |
2297bf0e | 2 | .\" |
38f20bb9 | 3 | .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) |
fea681da | 4 | .\" Distributed under GPL |
38f20bb9 | 5 | .\" %%%LICENSE_END |
38ecdde7 | 6 | .\" |
7dcae896 | 7 | .\" Heavily based on glibc infopages, copyright Free Software Foundation |
fea681da MK |
8 | .\" |
9 | .\" aeb, 2003, polished a little | |
fe0fefbf | 10 | .TH MEMPCPY 3 2015-03-02 "GNU" "Linux Programmer's Manual" |
fea681da MK |
11 | .SH NAME |
12 | mempcpy, wmempcpy \- copy memory area | |
13 | .SH SYNOPSIS | |
14 | .nf | |
b80f966b | 15 | .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
fea681da | 16 | .B #include <string.h> |
68e4db0a | 17 | .PP |
fea681da | 18 | .BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n ); |
f90f031e | 19 | |
b80f966b | 20 | .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" |
fea681da | 21 | .B #include <wchar.h> |
68e4db0a | 22 | .PP |
fea681da MK |
23 | .BI "wchar_t *wmempcpy(wchar_t *" dest ", const wchar_t *" src ", size_t " n ); |
24 | .fi | |
25 | .SH DESCRIPTION | |
c13182ef | 26 | The |
63aa9df0 | 27 | .BR mempcpy () |
fea681da | 28 | function is nearly identical to the |
fb186734 | 29 | .BR memcpy (3) |
c13182ef MK |
30 | function. |
31 | It copies | |
32 | .I n | |
fea681da | 33 | bytes from the object beginning at |
c13182ef MK |
34 | .I src |
35 | into the object pointed to by | |
36 | .IR dest . | |
37 | But instead of returning the value of | |
fea681da MK |
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 | |
63aa9df0 | 45 | .BR wmempcpy () |
4b4a8feb MK |
46 | function is identical but takes |
47 | .I wchar_t | |
48 | type arguments and copies | |
fea681da MK |
49 | .I n |
50 | wide characters. | |
47297adb | 51 | .SH RETURN VALUE |
c6fa0841 MK |
52 | .I dest |
53 | + | |
54 | .IR n . | |
2ee2e7eb MK |
55 | .SH VERSIONS |
56 | .BR mempcpy () | |
57 | first appeared in glibc in version 2.1. | |
a4005992 | 58 | .SH ATTRIBUTES |
ec993fc3 PH |
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 (), | |
a4005992 | 68 | .BR wmempcpy () |
ec993fc3 PH |
69 | T} Thread safety MT-Safe |
70 | .TE | |
47297adb | 71 | .SH CONFORMING TO |
2b2581ee | 72 | This function is a GNU extension. |
47297adb | 73 | .SH EXAMPLE |
207050fa | 74 | .EX |
fea681da | 75 | void * |
c13182ef | 76 | combine(void *o1, size_t s1, void *o2, size_t s2) |
41798314 | 77 | { |
0444be24 MK |
78 | void *result = malloc(s1 + s2); |
79 | if (result != NULL) | |
80 | mempcpy(mempcpy(result, o1, s1), o2, s2); | |
81 | return result; | |
fea681da | 82 | } |
207050fa | 83 | .EE |
47297adb | 84 | .SH SEE ALSO |
fea681da MK |
85 | .BR memccpy (3), |
86 | .BR memcpy (3), | |
87 | .BR memmove (3), | |
0a4f8b7b | 88 | .BR wmemcpy (3) |