Strcpy Function

Action

Copies a string into another string.

Include file

Kernel.bdh

Syntax

Strcpy( inout sDest   : string,
        in    sSource : string ): string;

Return value

The string actually copied.

Parameter Description
sDest Destination string
sSource Source string
Note: The use of this function has been expanded. It is possible to pass to the function either a string or a pointer to a buffer (in the latter case the keyword in has to be used).

Example

dcltrans
  transaction TStrcpy
  var
    sString1, sString2 : string;
    sOutput : string;
    nBuffer1, nBuffer2 : number;
  begin
    nBuffer1 := Malloc(100); nBuffer2 := Malloc(100);
    // copy "Hello world!" message to all strings and buffers
    Strcpy(sString1, "Hello world!");
    Strcpy(sString2, sString1);
    Strcpy(in nBuffer1, sString1);
    Strcpy(in nBuffer2, in nBuffer1);
    Strcpy(sOutput, in nBuffer2);
    write(sString2); writeln;
    write(sOutput); writeln;
    Free(nBuffer1); Free(nBuffer2);
  end TStrcpy;

Output

Hello world!
Hello world!