MOVEDATA(DOS) UNIX System V MOVEDATA(DOS)
Name
movedata - Copies bytes of data from one address to another.
Syntax
#include <memory.h>
#include <string.h>
void movedata(srcseg, srcoff, destseg, destoff, nbytes)
unsigned int srcseg;
unsigned int srcoff;
unsigned int destseg;
unsigned int destoff;
unsigned nbytes;
Description
The movedata function copies nbytes bytes from the source
address specified by srcseg:srcoff to the destination
address specified by destseg:destoff.
The movedata function is used to move far data in small- or
medium-model programs where segment addresses of data are
not implicitly known. In large-model programs, the memcpy or
memmove function can be used, since segment addresses are
implicitly known.
Return Value
None.
See Also
FP_OFF(DOS), FP_SEG(DOS), memcpy(S), memmove(DOS),
segread(DOS)
Notes
Segment values for the srcseg and destseg arguments can be
obtained by using either the segread function or the FP_SEG
macro.
The movedata function does not handle all cases of
overlapping moves correctly (overlapping moves occur when
part of the destination is the same memory area as part of
the source). Overlapping moves are handled correctly in the
memmove function.
Example
#include <memory.h>
#include <dos.h>
#include <malloc.h>
char far *src;
char far *dest;
main()
{
src = _fmalloc(512);
dest = _fmalloc(512);
movedata(FP_SEG(src), FP_OFF(src), FP_SEG(dest),
FP_OFF(dest), 512);
printf("The data have been moved\n");
}
This program uses movedata to move 512 bytes of data from
src to dest.
(printed 7/6/89)