void CMFCApplicationDlg::OnRadioBtnClicked() { UpdateData(TRUE); switch (m_nSex) { case 0: Sex = "男"; break; case 1: Sex = "女"; break; } }
CEdit* EDIT1; CEdit* EDIT2; CEdit* EDIT3; CEdit* EDIT4; CEdit* EDIT5; EDIT1 = (CEdit*)GetDlgItem(Editor1); EDIT1->GetWindowText(Name); EDIT2 = (CEdit*)GetDlgItem(Editor2); EDIT2->GetWindowText(Age); EDIT3 = (CEdit*)GetDlgItem(Editor3); EDIT3->GetWindowText(EMail); EDIT4 = (CEdit*)GetDlgItem(Editor4); EDIT4->GetWindowText(Address); EDIT5 = (CEdit*)GetDlgItem(Combobox1); EDIT5->GetWindowText(Politic); CString Info; Info = Name + " " + Sex + " " + Age + " " + EMail + " " + Politic + " " + Address; MessageBox(Info, _T("运行结果"), MB_OK); CStdioFile file; file.Open(path, CFile::modeWrite); int size = sizeof(Info); file.Write(Info,size); file.Close();
只写入第一个String