(C) 1998 AROS - The Amiga Research OS


NAME
#include <string.h>

void * memmove ()

SYNOPSIS
void * dest
const void * src
size_t count

FUNCTION
Copy the contents of a part of memory to another. Both areas may overlap.

INPUTS
dest
The first byte of the destination area in memory
src
The first byte of the source area in memory
count
How many bytes to copy

RESULT
dest.

EXAMPLE
#include 

unsigned char src[64];
unsigned char dst[64+8];

void showresult (void)
{
    int t;

    printf ("    %02x%02x%02x%02x,\n", dst[0], dst[1], dst[2], dst[2]);

    for (t=0; t<64; t++)
    {
	if ((t&15)==0)
	    printf ("    ");

	printf ("%02lx", dst[t+4]);

	if ((t&15)==15)
	    printf ("\n");
	else if ((t&3)==3)
	    printf (" ");
    }

    printf ("    %02x%02x%02x%02x\n", dst[68], dst[69], dst[70], dst[71]);
}

int main (int argc, char ** argv)
{
    char * s = src;
    char * d = &dst[4];
    int t;

    for (t=0; t<64; t++)
	src[t] = t+1;

    printf ("Initial state:\n");
    showresult ();

    printf ("Full copy:\n");
    memmove (d, s, 64);
    showresult ();

    printf ("Shift down:\n");
    memmove (d, s, 64);
    memmove (d, d+1, 63);
    showresult ();

    printf ("Shift up:\n");
    memmove (d, s, 64);
    memmove (d+1, d, 63);
    showresult ();

} /* main */
SEE ALSO
memcpy()

NOTES

BUGS

INTERNALS

HISTORY
20.10.1998 hkiel
Amiga Research OS
11.12.1996 aros
Added/corrected headers
10.12.1996 aros
New functions