]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/mempcpy.3
getresuid.2, intro.2, mremap.2, open.2, poll.2, posix_fadvise.2, pread.2, remap_file_...
[thirdparty/man-pages.git] / man3 / mempcpy.3
CommitLineData
fea681da
MK
1.\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2.\" Distributed under GPL
7dcae896 3.\" Heavily based on glibc infopages, copyright Free Software Foundation
fea681da
MK
4.\"
5.\" aeb, 2003, polished a little
46e04b72 6.TH MEMPCPY 3 2008-08-12 "GNU" "Linux Programmer's Manual"
fea681da
MK
7.SH NAME
8mempcpy, wmempcpy \- copy memory area
9.SH SYNOPSIS
10.nf
b80f966b 11.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
fea681da
MK
12.br
13.B #include <string.h>
14.sp
15.BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n );
16.sp
b80f966b 17.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
fea681da
MK
18.br
19.B #include <wchar.h>
20.sp
21.BI "wchar_t *wmempcpy(wchar_t *" dest ", const wchar_t *" src ", size_t " n );
22.fi
23.SH DESCRIPTION
c13182ef 24The
63aa9df0 25.BR mempcpy ()
fea681da 26function is nearly identical to the
fb186734 27.BR memcpy (3)
c13182ef
MK
28function.
29It copies
30.I n
fea681da 31bytes from the object beginning at
c13182ef
MK
32.I src
33into the object pointed to by
34.IR dest .
35But instead of returning the value of
fea681da
MK
36.I dest
37it returns a pointer to the byte following the last written byte.
38.PP
39This function is useful in situations where a number of objects
40shall be copied to consecutive memory positions.
41.PP
42The
63aa9df0 43.BR wmempcpy ()
4b4a8feb
MK
44function is identical but takes
45.I wchar_t
46type arguments and copies
fea681da
MK
47.I n
48wide characters.
49.SH "RETURN VALUE"
381edf46 50\fIdest\fP + \fIn\fP.
2ee2e7eb
MK
51.SH VERSIONS
52.BR mempcpy ()
53first appeared in glibc in version 2.1.
2b2581ee
MK
54.SH "CONFORMING TO"
55This function is a GNU extension.
fea681da
MK
56.SH "EXAMPLE"
57.nf
58void *
c13182ef 59combine(void *o1, size_t s1, void *o2, size_t s2)
41798314 60{
0444be24
MK
61 void *result = malloc(s1 + s2);
62 if (result != NULL)
63 mempcpy(mempcpy(result, o1, s1), o2, s2);
64 return result;
fea681da
MK
65}
66.fi
fea681da
MK
67.SH "SEE ALSO"
68.BR memccpy (3),
69.BR memcpy (3),
70.BR memmove (3),
0a4f8b7b 71.BR wmemcpy (3)