Integer i;
TBytes ByteArray;
 
void __fastcall WriteBytes(TBytes BArray, TEdit* Edit)
{
  for (i=0;i<BArray.Length;i++)
  {
      Edit->Text = Edit->Text + IntToStr(BArray[i]) + " ";
  }
}
 
void __fastcall TMainForm::btGetBytesClick(TObject *Sender)
{
  /* Convert the string into a byte array */
  ByteArray = BytesOf(Edit1->Text);
 
  /* Write the bytes in the second edit box */
  WriteBytes(ByteArray, Edit2);
 
  Edit1->Enabled = false;
  btGetBytes->Enabled = false;
  btGetWideBytes->Enabled = false;
}
 
void __fastcall TMainForm::btGetWideBytesClick(TObject *Sender)
{
  /* Convert the string into a byte array, with two bytes per character */
  ByteArray = WideBytesOf(Edit1->Text);
 
  /* Write the bytes in the second edit box */
  WriteBytes(ByteArray, Edit2);
 
  Edit1->Enabled = false;
  btGetBytes->Enabled = false;
  btGetWideBytes->Enabled = false;
}

 

posted on 2015-03-16 21:00  lypzxy  阅读(180)  评论(0编辑  收藏  举报