OSDN Git Service

(split) Import translated manuals from JM CVS Repository.
[linuxjm/LDP_man-pages.git] / original / man3 / mempcpy.3
1 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" Heavily based on glibc infopages, copyright Free Software Foundation
4 .\"
5 .\" aeb, 2003, polished a little
6 .TH MEMPCPY 3 2008-08-12 "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 (3)
28 function.
29 It copies
30 .I n
31 bytes from the object beginning at
32 .I src
33 into the object pointed to by
34 .IR dest .
35 But instead of returning the value of
36 .I dest
37 it returns a pointer to the byte following the last written byte.
38 .PP
39 This function is useful in situations where a number of objects
40 shall be copied to consecutive memory positions.
41 .PP
42 The
43 .BR wmempcpy ()
44 function is identical but takes
45 .I wchar_t
46 type arguments and copies
47 .I n
48 wide characters.
49 .SH "RETURN VALUE"
50 \fIdest\fP + \fIn\fP.
51 .SH VERSIONS
52 .BR mempcpy ()
53 first appeared in glibc in version 2.1.
54 .SH "CONFORMING TO"
55 This function is a GNU extension.
56 .SH "EXAMPLE"
57 .nf
58 void *
59 combine(void *o1, size_t s1, void *o2, size_t s2)
60 {
61     void *result = malloc(s1 + s2);
62     if (result != NULL)
63         mempcpy(mempcpy(result, o1, s1), o2, s2);
64     return result;
65 }
66 .fi
67 .SH "SEE ALSO"
68 .BR memccpy (3),
69 .BR memcpy (3),
70 .BR memmove (3),
71 .BR wmemcpy (3),
72 .BR feature_test_macros (7)