]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/mempcpy.3
Code formatting fixes
[thirdparty/man-pages.git] / man3 / mempcpy.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" based on glibc infopages
4 .\"
5 .\" aeb, 2003, polished a little
6 .TH mempcpy 3 2003-11-11 "GNU" "Linux Programmer's Manual"
7 .SH NAME
8 mempcpy, wmempcpy \- copy memory area
9 .SH SYNOPSIS
10 .nf
11 .B #define _GNU_SOURCE
12 .br
13 .B #include <string.h>
14 .sp
15 .BI "void *mempcpy(void *" dest ", const void *" src ", size_t " n );
16 .sp
17 .B #define _GNU_SOURCE
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
24 The
25 .BR mempcpy ()
26 function is nearly identical to the
27 .BR memcpy ()
28 function. It copies
29 .I n
30 bytes from the object beginning at
31 .I src
32 into the object pointed to by
33 .IR dest .
34 But instead of returning the value of
35 .I dest
36 it returns a pointer to the byte following the last written byte.
37 .PP
38 This function is useful in situations where a number of objects
39 shall be copied to consecutive memory positions.
40 .PP
41 The
42 .BR wmempcpy ()
43 function is identical but takes
44 .I wchar_t
45 type arguments and copies
46 .I n
47 wide characters.
48 .SH "RETURN VALUE"
49 \fIdest\fP + \fIn\fP .
50 .SH "EXAMPLE"
51 .nf
52 void *
53 combine(void *o1, size_t s1, void *o2, size_t s2)
54 {
55 void *result = malloc(s1 + s2);
56 if (result != NULL)
57 mempcpy(mempcpy(result, o1, s1), o2, s2);
58 return result;
59 }
60 .fi
61 .SH "CONFORMING TO"
62 This function is a GNU extension.
63 .SH "SEE ALSO"
64 .BR memccpy (3),
65 .BR memcpy (3),
66 .BR memmove (3),
67 .BR wmemcpy (3),
68 .BR feature_test_macros (7)