memcpy(), _fmemcpy()

copy a number of characters from one buffer to another


#include <string.h>
void *memcpy( void *dst,
              const void *src,
              size_t length );
void __far *_fmemcpy( void __far *dst,
                      const void __far *src,
                      size_t length );


The memcpy() function copies length characters from the buffer pointed to by src into the buffer pointed to by dst.

Note: Copying of overlapping objects isn't guaranteed to work properly. See the memmove() function if you wish to copy objects that overlap.

The _fmemcpy() function is a data-model-independent form of the memcpy() function. It accepts far pointer arguments, and returns a far pointer. It is most useful in mixed memory model applications.


A pointer to the destination buffer (that is, the value of dst).


#include <stdio.h>
#include <string.h>

void main()
    char buffer[80];

    memcpy( buffer, "Hello", 5 );
    buffer[5] = '\0';
    printf( "%s\n", buffer );


memcpy() is ANSI; _fmemcpy() is WATCOM.
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

memchr(), memcmp(), memicmp(), memmove(), memset()