qp.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
MOVEDATA.PAS
  Example Contents Index                                    Back
 
PROGRAM movedata;
 
{ MOVEDATA.PAS uses routines to initialize and move blocks of data,
  independent of type, including:
 
      FillChar    FreeMem    GetMem    Move    SizeOf
}
 
CONST
    program_name = 'MOVEDATA ';
    program_desc = 'initializes a buffer in memory' +
                   ' and moves it to a string.';
    nbytes       = 64;
 
TYPE
    int32arr = ARRAY[1..32] OF Word;
    string64 = ARRAY[1..64] OF Char;
 
VAR
    memptr    : ^int32arr;
    equiv_str : string64;
 
BEGIN
 
    Writeln( program_name, program_desc );
    Writeln;
 
    { Get a block of memory to play with. }
    GetMem( memptr, SizeOf( int32arr ) );
    Writeln( 'Memory allocated. ');
 
    { Fill it with a value. }
    FillChar( memptr^, SizeOf( memptr^ ), 'P' );
    Writeln( '32-word array filled with ''P''' );
 
    { Copy this to a real string. }
    Move( memptr^, equiv_str, SizeOf( memptr^ ) );
    Writeln( '64 bytes moved to 64-character array:' );
 
    { Verify. }
    Writeln( equiv_str );
 
    FreeMem( memptr, SizeOf( int32arr ) );
 
END.