Export (0) Print
Expand All
Expand Minimize

memcpy, wmemcpy

Copies characters between buffers.

void *memcpy(
   void *dest,
   const void *src,
   size_t count 
);
wchar_t *wmemcpy(
   wchar_t *dest,
   const wchar_t *src,
   size_t count
);

Parameters

dest
New buffer.
src
Buffer to copy from.
count
Number of bytes to copy.

Return Value

The value of dest.

Remarks

Copies count bytes of src to dest. If the source and destination overlap, the behavior of memcpy is undefined. Use memmove to handle overlapping regions.

Security Note   Make sure that the destination buffer is the same size or larger than the source buffer. For more information, see Avoiding Buffer Overruns.

Requirements

Routine Required header Compatibility
memcpy <memory.h> or <string.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP
wmemcpy <wchar.h> ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example

See memmove for a sample of how to use memcpy.

See Also

Buffer Manipulation Routines | _memccpy | memchr | memcmp | memmove | memset | strcpy | strncpy | Run-Time Routines and .NET Framework Equivalents

Show:
© 2014 Microsoft