1mempcpy(3) Linux Programmer's Manual mempcpy(3)
2
3
4
6 mempcpy, wmempcpy - copy memory area
7
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
20 The mempcpy() function is nearly identical to the memcpy() 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
32 dest + n .
33
35 void *
36 combine (void *o1, size_t s1, void *o2, size_t s2) {
37 void *result = malloc(s1 + s2);
38 if (result != NULL)
39 mempcpy(mempcpy(result, o1, s1), o2, s2);
40 return result;
41 }
42
44 This function is a GNU extension.
45
47 memccpy(3), memcpy(3), memmove(3), wmemcpy(3), feature_test_macros(7)
48
49
50
51GNU 2003-11-11 mempcpy(3)