Void system2: : DoDataExchange (CDataExchange * symbol)
{
CDialogEx: : DoDataExchange (symbol);
DDX_Text (symbol, IDC_EDIT1, sname);
DDX_Text (IDC_EDIT2 symbol, snum);
DDX_Text (IDC_EDIT3 symbol, sy);
DDX_Text (symbol, IDC_EDIT4, sm);
DDX_Text (symbol, IDC_EDIT5, sd);
DDX_Text (symbol, IDC_EDIT6 sgame);
DDX_Text (symbol, IDC_EDIT7, sun);
DDX_Text (symbol, IDC_EDIT8 sphone);
/* DDX_Radio (symbol, IDC_RADIO1, man);
DDX_Radio (symbol, IDC_RADIO2, wman); */
DDX_Text (symbol, IDC_EDIT9, sex);
}
Void system2: : OnBnClickedButton1 ()
{
//TODO: add the control notification handler code
The student u;
U.s tuname=sname;
U.s tunum=snum;
U.y ear=sy.
U.m onth=sm;
U.d ay=sd;
U.s tugame=sgame;
U.u nit=sun;
U.p hone=sphone;
U.s tusex=sex;
CFile file;
if (! (the file Open (_T (" d: \ \ 11. TXT "), CFile: : modeReadWrite | CFile: : modeCreate | CFile: : shareDenyNone)))
{
MessageBox (_T (" unable to open file "));
return;
}
File. The Write (& amp; U, sizeof (u));
File. The Close ();
MessageBox (" success ");
CDialog: : EndDialog (0);
}
To help you, why I can't write information into the file?
Which is not an error, but just can not write the data
CodePudding user response:
More problems
1. The UpdateData (true); Update control variables binding
CodePudding user response: