Memcpy Function

Action

Copies characters between two memory pointers.
Note: This function is obsolete. It can still be used, although it's recommended to use the SetMem function instead.

Include file

Kernel.bdh

Syntax

Memcpy( inout sDest   : string,
        in    sSource : string,
        in    nCount  : number ): number;

Return value

value of nDest

Parameter Description
sDest Pointer to destination buffer
sSource Pointer to buffer to copy from
nCount Number of bytes to copy

Example

dcltrans
  transaction TMemcpy
  var
    sSource, sDest : string;
  begin
    sSource := Malloc(10);
    sDest   := Malloc(10);

    Memset(sSource, ord('*'), 10);
    write("source buffer initialized"); writeln;
    Memcpy(sDest, sSource, 10);
    write("buffer copied"); writeln;
    Free(sSource); Free(sDest);
  end TMemcpy;

Output

source buffer initialized
buffer copied