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

#include <vcl.h>
#pragma hdrstop

#include "StrECopy.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
	: TForm(Owner)
{
}
//---------------------------------------------------------------------------
// BeginExample: StrECopy
// Routine: SysUtils.StrECopy

// BeginCode
/*
The following example uses an edit control, a label, and a
button on a form. When the button is clicked, the edit
control’s text is appended to a static buffer. Then the
buffer is displayed in the label’s caption.
*/ 
const static int MAX_LENGTH = 15;
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  static char szBuffer[MAX_LENGTH];
  static char* pszBuffer = szBuffer;

  if (StrLen(pszBuffer) + StrLen(Edit1->Text.c_str()) < MAX_LENGTH)
	pszBuffer = StrECopy(pszBuffer, Edit1->Text.t_str());
  else
    ShowMessage("Can't fit new string in allocated memory space.");
  Label1->Caption = szBuffer;
}
// EndCode
// EndExample: StrECopy
//---------------------------------------------------------------------------
