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

#include <vcl.h>
#pragma hdrstop

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

// 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 copied into a buffer. Then the buffer is
displayed backwards in the label.
*/

#include <memory>       //for STL auto_ptr class

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  std::auto_ptr<char> pszEditText(new char[Edit1->Text.Length()+1]);
  char *psz;
  StrCopy(pszEditText.get(), Edit1->Text.t_str());
  psz = StrEnd(pszEditText.get());
  Label1->Caption = "";
  while (psz >= &pszEditText.get()[0])
  {
    psz--;
    Label1->Caption = Label1->Caption + *psz;
  }
}
// EndCode
// EndExample: SysUtilsStrEnd
//---------------------------------------------------------------------------
