Advertisement

Whats the difference between....

Started by May 20, 2001 08:14 PM
2 comments, last by Xtreme 23 years, 8 months ago
memcpy & memmove? I looked it up on MSDN library and from their example I couldn''t find a difference!! Can anyone explain the difference? thanks in advance.
Yes! There are kangaroos in Australia but I haven't seen them...yet
The differnece is that the memory buffers can''t overlap with memcpy. For example you have and array and you want to copy data from one part of the array to another, the section you want to copy may overlap, memcpy can cause an error if you do this. memmove on the otherhand is safe, it checks to see if the buffers overlap, and will adapt. Because of the check memmove is a tad slower than memcpy. If you know the buffers won''t overlap use memcpy, otherwise use memmove.

-Omalacon
Advertisement
so basically what you are saying is the source pointer''s contents cannot overlap the destination pointer''s contents in memcpy but it is ok with memmove?
Yes! There are kangaroos in Australia but I haven't seen them...yet
exactly

-Omalacon

This topic is closed to new replies.

Advertisement