unit StrCat;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: StrCat
// Routine: SysUtils.StrCat
// Routine: SysUtils.StrCopy

// BeginCode
{
The following example uses an edit control, a label, and a button
on a form. When the button is clicked, the label’s caption and the
edit control’s text are combined in a buffer. Then the buffer is
displayed in the label’s caption.
} 
procedure TForm1.Button1Click(Sender: TObject);
var
  Buffer: PChar;
begin
  GetMem(Buffer,Length(Label1.Caption) + Length(Edit1.Text) + 1);
  StrCopy(Buffer, PChar(Label1.Caption));
  SysUtils.StrCat(Buffer, PChar(Edit1.Text));
  Label1.Caption := Buffer;
  Edit1.Clear;
  FreeMem(Buffer);
end;
// EndCode
// EndExample: StrCat
end.
