blockmove(3C)
_________________________________________________________________
blockmove $builtin function
Move bytes from one location in memory to another.
_________________________________________________________________
Calling Sequence
char *source, *dest, *blockmove();
int num;
blockmove(dest, source, num);
(or)
$builtin char *blockmove();
char *source, *dest;
int num;
blockmove(dest, source, num);
where source is a pointer to the bytes to move.
num is the number of bytes to move.
dest is a pointer to the location to move them to.
Description
Use the blockmove function to copy a specified number of bytes
from one memory location to another. This function is identical
to the memcpy function.
The first calling sequence noted above uses a function call. The
second might generate smaller or faster code, but may not run
under other C compilers.
The include file dglib.h defines the blockmove function.
Returns
The blockmove function returns a byte pointer to the destination.
Related Functions
See also the memcpy, strncpy, and strcpy functions.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
blockmove(3C)
Example
/* Program test for the blockmove() function */
#include <stdio.h>
#include <dglib.h>
int i, count;
char *dest;
char *source = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz0123456789\
!@#$%^&*()_-+=~`\\|[]{}\'\";:/.,<>";
main(argc, argv)
int argc;
char *argv[];
{
dest = alloc(strlen(source));
count = atoi(argv[1]);
for(i = 1; i <= count; i++){
blockmove(dest, source, i);
printf("The first %d character(s):\n%.@s\n\n",
i, i, dest);
}
}
A call to the program test with an argument of 5 generates the
output
The first 1 character(s):
A
The first 2 character(s):
AB
The first 3 character(s):
ABC
The first 4 character(s):
ABCD
The first 5 character(s):
ABCDE
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)