3 ms·
Right. Quoting from the manpage: > The memory areas may overlap: copying takes place as though the bytes in src are first copied into a temporary array that do
by derleth 15y ago
Right. Quoting from the manpage:
> The memory areas may overlap: copying takes place as though the bytes in src are first copied into a temporary array that does not overlap src or dest, and the bytes are then copied from the temporary array to dest.
http://www.kernel.org/doc/man-pages/online/pages/man3/memmove.3.html http://www.kernel.org/doc/man-pages/online/pages/man3/memmov...
Notice how it says 'as though'; I can't see why doing the copy backwards (from end to start) wouldn't work, myself.
- eddington 15y agoStill doesn't work going end to start. src starts at 50, ends at 100 dst starts at 25, ends at 75. First we copy 100 to 75, then 99 to 74, etc ... now we get to copy from 75 to 50, but we've overwritten it already!
- sp332 15y agoIf it's higher, move from the front. If it's lower, start at the back. You have to check each time you do it.
- suivix 15y agoLinux isn't Unix, so are you sure it's the same?