我有一个用 wxwidgets 设计的 UI,我在其中输入用户名。我想要所有元素的十六进制总和,然后将其转换为十进制。这就是我所做的:
wxArrayString TextAlia = wxT("");//declared global
TextBox1 = new wxTextCtrl(this, TEXT_BOX1, wxT(""), wxPoint(300, 10), wxSize(100, 20), wxTE_PROCESS_ENTER | wxTE_PROCESS_TAB | wxTE_LEFT, wxDefaultValidator, wxT("WxTextBox"));
void MyFrame::OnGenerateKey(wxCommandEvent& WXUNUSED(event)) {
int i;
char name[i];
TextAlia = TextBox1->GetValue();
i = strlen(TextAlia);
for (i = 0; i < strlen(TextAlia); i++) {
char buffer[3];char Temp[3];
_itoa( name[i], buffer, 16 );
}
这是我试图做的,请帮助我。
现在 id 所做的是:
int lengtharray = sizeof(name)/sizeof(name[0]);
for (int j=0; j<lengtharray; j++)
{
name[j] = ?//i need to write something here so that the name[1] is changed to 45 for
capital "E"
// avariable may be of type hex just like sum that keeps on incrementing the value
}