memcpy, _fmemcpy
partly corrected
Copies a block of n bytes.
Defined in header <mem.h>
Syntax
#include <mem.h>
Near version: void *memcpy(void *dest, const void *src, size_t n);
Far version: void far *far _fmemcpy(void far *dest, const void far *src,
size_t n);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only | |
|---|---|---|---|---|---|
| Near version | ■ | ■ | ■ | ■ | |
| Far version | ■ | ■ |
Remarks
memcpy is available on UNIX System V systems.
memcpy copies a block of n bytes from src to dest. If src and dest overlap, the behavior of memcpy is undefined.
Return value
memcpy returns dest.
See also
Example
#include <stdio.h>
*include <string.h>
int main(void)
{
char srcn = "******************************"•
chardest[] = "abcdefghi]lkmnopqrstuvwxyz0123455709" ;
char *ptr;
printf("destination before memcpy. Is\n", dest);
ptr = (char *) memcpy(dest, src, strlen(src));
if (ptr)
printf("destination after memcpy: %s\n", dest);
else
printf("memcpy failed\n");
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/mem.h/memcpy/
· short form /3.1/memcpy/