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

NAME

6       mempcpy, wmempcpy  - copy memory area
7

SYNOPSIS

9       #define _GNU_SOURCE
10       #include <string.h>
11
12       void *mempcpy(void *dest, const void *src, size_t n);
13
14       #define _GNU_SOURCE
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

CONFORMING TO

38       This function is a GNU extension.
39

EXAMPLE

41       void *
42       combine(void *o1, size_t s1, void *o2, size_t s2)
43       {
44           void *result = malloc(s1 + s2);
45           if (result != NULL)
46               mempcpy(mempcpy(result, o1, s1), o2, s2);
47           return result;
48       }
49

SEE ALSO

51       memccpy(3), memcpy(3), memmove(3), wmemcpy(3), feature_test_macros(7)
52

COLOPHON

54       This page is part of release 3.22 of the Linux  man-pages  project.   A
55       description  of  the project, and information about reporting bugs, can
56       be found at http://www.kernel.org/doc/man-pages/.
57
58
59
60GNU                               2008-08-12                        MEMPCPY(3)
Impressum