INtime SDK Help
memcpy, memcpy_s, wmemcpy, wmemcpy_s

Copies specified number of bytes from a source buffer to a destination buffer.

#include <string.h>

void *memcpy(void *dest, const void *src, size_t count);
errno_t memcpy_s(void *dest, rsize_t destmax, const void *src, rsize_t count);

#include <wchar.h>

wchar_t *wmemcpy(wchar_t *dest, const wchar_t *src, size_t num);
errno_t wmemcpy_s(wchar_t *dest, size_t destmax, const void *src, size_t count);

Parameters

dest
Buffer to copy to.
src
Buffer to copy from.
count
Number of characters to copy (copies bytes for memcpy, wide characters for wmemcpy).
destmax
Maximum size of destination buffer (i bytes for memcpy, wide characters for wmemcpy).

Remarks

If src and dest overlap, memcpy does not ensure that the original source bytes in the overlapping region are copied before being overwritten. Use memmove to handle overlapping regions.

The memcpy_s function copies count characters from the object pointer to by src to the object pointed to by dest. This function is subject to runtime constraints:

If there is a runtime violation, the memcpy_s function stores zeros in the first destmax charaters of the object pointed to by dest if dest is not a null pointer and destmax is not greater than RSIZE_MAX.

Return Values

memcpy and wmemcpyreturn a pointer to the destination buffer passed in.

memcpy_s and wmemcpy_s return zero if there was not a runtime violation. Otherwise, a non-zero value is returned.

Requirements

Versions Defined in Include Link to
INtime 3.0 intime/rt/include/string.h string.h clib.lib
INtime 4.2 (memcpy_s) intime/rt/include/string.h string.h clib.lib
INtime 6.0 (for wide-character versions) intime/rt/include/wchar.h wchar.h clib.lib
See Also