memmove_s
Go Up to mem.h Index
Header File
mem.h, string.h
Category
Memory and String Manipulation Routines
Prototype
void _FAR * _RESTRICT __dest, rsize_t __destmax, const void _FAR * _RESTRICT __src, rsize_t __n);
Description
Replaces memmove adding security enhancements.
memmove_s copies a block of __n bytes from __src to __dest. Even when the source and destination blocks overlap, bytes in the overlapping locations are copied correctly.
Return Value
memmove returns dest.
Example
#include <string.h> #include <stdio.h> int main(void) { char *dest = "abcdefghijklmnopqrstuvwxyz0123456789"; char *src = "******************************"; printf("destination prior to memmove: %s\n", dest); memmove_s(dest, 26, src, 26); printf("destination after memmove: %s\n", dest); return 0; }
Portability
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
memmove_s |
+ |
+ |
+ |
+ |