/*
StrComp example
The following example uses two edit controls and a button on a form. When the button is clicked, the text in the edit controls is compared.
*/
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  char* szResult = new char[Edit1->Text.Length() + Edit2->Text.Length() + 20];
  // the following line is used in VCL applications
int iResult = StrComp(Edit1->Text.c_str(), Edit2->Text.c_str());
  // the following line is used in CLX applications
  // int iResult = StrComp(WideCharToString(Edit1->Text.c_bstr()).c_str(), WideCharToString(Edit2->Text.c_bstr()).c_str());

  // the following line is used in VCL applications
  StrCopy(szResult, Edit1->Text.c_str());
  // the following line is used in CLX applications
  // StrCopy(szResult, WideCharToString(Edit1->Text.c_bstr()).c_str());
  if (iResult < 0)
    StrCat(szResult, " is less than ");
  else if (iResult > 0)
    StrCat(szResult, " is greater than ");
  else
    StrCat(szResult, " is equal to ");

  // the following line is used in VCL applications
  StrCat(szResult, Edit2->Text.c_str());
  // the following line is used in CLX applications
  // StrCat(szResult, WideCharToString(Edit2->Text.c_bstr()).c_str());
  ShowMessage(AnsiString(szResult));

  delete [] szResult;
} 
