RAD Studio
ContentsIndex
PreviousUpNext
memcpy, _wmemcpy

Header File 

mem.h, string.h  

Category 

Memory and String Manipulation Routines, Inline Routines 

Prototype 

void *memcpy(void *dest, const void *src, size_t n); 

void *_wmemcpy(void *dest, const void *src, size_t n); 

Description 

Copies a block of n bytes. 

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. 

Example  

#include <stdio.h>
#include <string.h>
int main(void)
{
   char src[] = "******************************";
   char dest[] = "abcdefghijlkmnopqrstuvwxyz0123456709";
   char *ptr;
   printf("destination before memcpy: %s\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;
}

Portability

 
POSIX 
Win32 
ANSI C 
ANSI C++ 
memcpy 
_wmemcpy 
 
 
 
Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!