Moves characters to another segment.
#include <memory.h> | Required only for function declarations | |
#include <string.h> | Use either STRING.H or MEMORY.H |
void _movedata( unsigned int srcseg, unsigned int srcoff, unsigned int destseg,
unsigned int destoff, unsigned int count );
srcseg | Segment address of source | |
srcoff | Segment offset of source | |
destseg | Segment address of destination | |
destoff | Segment offset of destination | |
count | Number of bytes |
The _movedata function copies count bytes from the source address specified by srcseg:srcoff to the destination address specified by destseg:destoff.
The _movedata function was intended to move far data in small-model programs. The newer model-independent _fmemcpy and _fmemmove functions should be used instead of the _movedata function. In large-model programs, the memcpy and memmove functions can also be used.
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. These occur when part of the destination is the same memory area as part of the source. The memmove function correctly handles overlapping moves.
None.
Standards:None
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:None
_FP_OFF, _FP_SEG, memcpy, memmove, _segread
/* MOVEDATA.C */
#include <memory.h>
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <malloc.h>
char __far *src = "This is a test.";
void main( void )
{
char __far *dest;
if( (dest = _fmalloc( 80 )) != NULL )
{
_movedata( _FP_SEG( src ), _FP_OFF( src ),
_FP_SEG( dest ), _FP_OFF( dest ), _fstrlen( src ) + 1 );
printf( "The source data at %Fp is '%Fs'\n", src, src );
printf( "The destination data at %Fp is '%Fs'\n", dest, dest );
_ffree( dest );
}
}
The source data at 2D0A:02B8 is 'This is a test.'
The destination data at 3D0B:0016 is 'This is a test.'