]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/mempcpy.3
mempcpy.3: srcfix
[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 2008-08-12 "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 \fIdest\fP + \fIn\fP.
55 .SH VERSIONS
56 .BR mempcpy ()
57 first appeared in glibc in version 2.1.
58 .SH CONFORMING TO
59 This function is a GNU extension.
60 .SH EXAMPLE
61 .nf
62 void *
63 combine(void *o1, size_t s1, void *o2, size_t s2)
64 {
65 void *result = malloc(s1 + s2);
66 if (result != NULL)
67 mempcpy(mempcpy(result, o1, s1), o2, s2);
68 return result;
69 }
70 .fi
71 .SH SEE ALSO
72 .BR memccpy (3),
73 .BR memcpy (3),
74 .BR memmove (3),
75 .BR wmemcpy (3)