/*
StrEnd example
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.
*/ 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  char *pszEditText = new char[Edit1->Text.Length()+1];
  char *psz;
// the following line is used for VCL applications
  StrCopy(pszEditText, Edit1->Text.c_str());
// the following line is used for CLX applications
//  StrCopy(pszEditText, WideCharToString(Edit1->Text.c_bstr()).c_str());
  psz = StrEnd(pszEditText);
  Label1->Caption = "";
  while (psz >= &pszEditText[0])
  {
    psz--;
    Label1->Caption = Label1->Caption + *psz;
  }
  delete [] pszEditText;
} 
