Jump to content
YOUR-AD-HERE
HOSTING
TOOLS

Locked function memmove


dEEpEst

Recommended Posts

function

[h=1]memmove[/h]void * memmove ( void * destination, const void * source, size_t num );

Move block of memory

Copies the values of num bytes from the location pointed by source to the memory block pointed by destination. Copying takes place as if an intermediate buffer were used, allowing the destination and source to overlap.

 

The underlying type of the objects pointed by both the source and destination pointers are irrelevant for this function; The result is a binary copy of the data.

 

The function does not check for any terminating null character in source - it always copies exactly num bytes.

 

To avoid overflows, the size of the arrays pointed by both the destination and source parameters, shall be at least numbytes.

 

[h=3]Parameters[/h]destinationPointer to the destination array where the content is to be copied, type-casted to a pointer of type void*.sourcePointer to the source of data to be copied, type-casted to a pointer of type const void*.numNumber of bytes to copy.

size_t is an unsigned integral type.

[h=3]Return Value[/h]destination is returned.

 

[h=3]Example[/h][TABLE=class: snippet]

[TR]

[TD=class: rownum, align: right]1

2

3

4

5

6

7

8

9

10

11

[/TD]

[TD=class: source]/* memmove example */

#include

#include

 

int main ()

{

char str[] = "memmove can be very useful......";

memmove (str+20,str+15,11);

puts (str);

return 0;

}[/TD]

[TD=class: C_btnholder]

 

 

[/TD]

[/TR]

[/TABLE]

 

 

 

Output:

[TABLE=class: snippet]

[TR]

[TD=class: output]

memmove can be very very useful.

[/TD]

[/TR]

[/TABLE]

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.