COHERENT manpages
This page displays the COHERENT manpage for memcpy() [Copy one region of memory into another].
List of available manpages
Index
memcpy() -- String Function (libc) Copy one region of memory into another #include <string.h> char *memcpy(region1, region2, n) vaddr_t region1; vaddr_t region2; unsigned int n; memcpy() copies n characters from region2 into region1. Unlike the routines strcpy() and strncpy(), memcpy() copies from one region to another. Therefore, it will not halt automatically when it encounters NUL. memcpy() returns region1. Example The following example copies a structure and displays it. #include <string.h> #include <stdio.h> struct stuff { int a, b, c; } x, y; main() { x.a = 1; /* this would stop strcpy or strncpy. */ x.b = 0; x.c = 3; /* y = x; would do the same */ memcpy(&y, &x, sizeof(y)); printf("a =%d, b =%d, c =%d\n", y.a, y.b, y.c); return(EXIT_SUCCESS); } See Also libc, strcpy(), string.h ANSI Standard, §7.11.2.1 Notes If region1 and region2 overlap, the behavior of memcpy() is undefined. region1 should point to enough reserved memory to hold n bytes of data; otherwise, code or data will be overwritten.