]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/mempcpy.3
crypt.3: srcfix: rewrap source lines
[thirdparty/man-pages.git] / man3 / mempcpy.3
CommitLineData
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
12mempcpy, 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 26The
63aa9df0 27.BR mempcpy ()
fea681da 28function is nearly identical to the
fb186734 29.BR memcpy (3)
c13182ef
MK
30function.
31It copies
32.I n
fea681da 33bytes from the object beginning at
c13182ef
MK
34.I src
35into the object pointed to by
36.IR dest .
37But instead of returning the value of
fea681da
MK
38.I dest
39it returns a pointer to the byte following the last written byte.
40.PP
41This function is useful in situations where a number of objects
42shall be copied to consecutive memory positions.
43.PP
44The
63aa9df0 45.BR wmempcpy ()
4b4a8feb
MK
46function is identical but takes
47.I wchar_t
48type arguments and copies
fea681da
MK
49.I n
50wide characters.
47297adb 51.SH RETURN VALUE
c6fa0841
MK
52.I dest
53+
54.IR n .
2ee2e7eb
MK
55.SH VERSIONS
56.BR mempcpy ()
57first appeared in glibc in version 2.1.
a4005992 58.SH ATTRIBUTES
ec993fc3
PH
59For an explanation of the terms used in this section, see
60.BR attributes (7).
61.TS
62allbox;
63lbw21 lb lb
64l l l.
65Interface Attribute Value
66T{
67.BR mempcpy (),
a4005992 68.BR wmempcpy ()
ec993fc3
PH
69T} Thread safety MT-Safe
70.TE
47297adb 71.SH CONFORMING TO
2b2581ee 72This function is a GNU extension.
47297adb 73.SH EXAMPLE
207050fa 74.EX
fea681da 75void *
c13182ef 76combine(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)