大家帮忙翻译一下:c++的一个函数→delphi
void __fastcall TForm1::Button3Click(TObject *Sender)
{
unsigned char Buffer[100];
unsigned char Card_Type[2];
bool ct;
char temp[50];
unsigned char Card;
int mv;
if(!comopen) goto endss;
ct=!(ComboBox1->Text.SubString(1,2)=="23"||ComboBox1->Text.SubString(1,2)=="24");
if( ct||Edit2->Text.Length()!=8||Edit3->Text.Length()!=6||
Edit4->Text.Length()!=20||Edit5->Text.Length()!=6)
Application->MessageBoxA("检查输入是否正确!","Error",MB_OK);
else
{
strcpy(Card_Type,(ComboBox1->Text.SubString(1,2)).c_str());
strcpy(Buffer,(Edit2->Text.SubString(1,8)).c_str());
strcat(Buffer,(Edit3->Text.SubString(1,6)).c_str());
strcat(Buffer,(Edit4->Text.SubString(1,20)).c_str());
strcat(Buffer,(Edit5->Text.SubString(1,6)).c_str());
strcat(Buffer,"0000000000000000000000000000000000");
if(RadioButton3->Checked==1)
Card=0;
else
Card=7;
mv=write_card(Card,Card_Type,Buffer);
if(mv!=0)
{
sprintf(temp," 写卡失败!返回值为:%d",mv);
Application->MessageBoxA(temp,"错误!", MB_OK);
}
else
Application->MessageBox("写卡成功!","成功!",MB_OK);
return;
}
endss:
Application->MessageBox("请打开串口","错误",MB_OK);
}