//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "StrCat.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// 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.
*/

#include <memory>       //for STL auto_ptr class

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  std::auto_ptr<char> szBuffer(new char[Label1->Caption.Length() + Edit1->Text.Length() + 1]);
  // The following 2 lines are used in VCL applications
  StrCopy(szBuffer.get(), AnsiString(Label1->Caption).c_str());
  StrCat(szBuffer.get(), AnsiString(Edit1->Text).c_str());
  Label1->Caption = szBuffer.get();
  Edit1->Clear();
}
// EndCode
// EndExample: StrCat
//---------------------------------------------------------------------------
