1MEMPCPY(3)                 Linux Programmer's Manual                MEMPCPY(3)
2
3
4

NAME

6       mempcpy, wmempcpy  - copy memory area
7

SYNOPSIS

9       #define _GNU_SOURCE         /* See feature_test_macros(7) */
10       #include <string.h>
11
12       void *mempcpy(void *dest, const void *src, size_t n);
13
14       #define _GNU_SOURCE         /* See feature_test_macros(7) */
15       #include <wchar.h>
16
17       wchar_t *wmempcpy(wchar_t *dest, const wchar_t *src, size_t n);
18

DESCRIPTION

20       The  mempcpy()  function is nearly identical to the memcpy(3) function.
21       It copies n bytes from the object beginning  at  src  into  the  object
22       pointed  to  by  dest.   But  instead of returning the value of dest it
23       returns a pointer to the byte following the last written byte.
24
25       This function is useful in situations where a number of  objects  shall
26       be copied to consecutive memory positions.
27
28       The  wmempcpy()  function is identical but takes wchar_t type arguments
29       and copies n wide characters.
30

RETURN VALUE

32       dest + n.
33

VERSIONS

35       mempcpy() first appeared in glibc in version 2.1.
36

ATTRIBUTES

38       For  an  explanation  of  the  terms  used   in   this   section,   see
39       attributes(7).
40
41       ┌──────────────────────┬───────────────┬─────────┐
42Interface             Attribute     Value   
43       ├──────────────────────┼───────────────┼─────────┤
44mempcpy(), wmempcpy() │ Thread safety │ MT-Safe │
45       └──────────────────────┴───────────────┴─────────┘

CONFORMING TO

47       This function is a GNU extension.
48

EXAMPLE

50       void *
51       combine(void *o1, size_t s1, void *o2, size_t s2)
52       {
53           void *result = malloc(s1 + s2);
54           if (result != NULL)
55               mempcpy(mempcpy(result, o1, s1), o2, s2);
56           return result;
57       }
58

SEE ALSO

60       memccpy(3), memcpy(3), memmove(3), wmemcpy(3)
61

COLOPHON

63       This  page  is  part of release 4.16 of the Linux man-pages project.  A
64       description of the project, information about reporting bugs,  and  the
65       latest     version     of     this    page,    can    be    found    at
66       https://www.kernel.org/doc/man-pages/.
67
68
69
70GNU                               2015-03-02                        MEMPCPY(3)
Impressum