memcpy, _fmemcpy

copy a number of characters from one buffer to another

Synopsis:

#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 );

Description:

The memcpy() and _fmemcpy() functions copy length characters from the buffer pointed to by src into the buffer pointed to by dst.

Copying of overlapping objects is not 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.

Returns:

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

See also:

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

Examples:

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

void main()
  {
    char buffer[80];

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

Classification:

memcpy() is ANSI; _fmemcpy() is WATCOM.

Systems:

memcpy()
All (except DOS/PM)
_fmemcpy()
All (except Netware, DOS/PM)