VC如何将两对话框里编辑框的参数保存到同一个文件?
1个回答
展开全部
如果是参数=内容的话就好解决:
string edit1,edit2;
CString edit1_c,edit2_c;
GetDlgItem(IDC_EDIT1)->GetWindowText(edit1_c);
GetDlgItem(IDC_EDIT2)->GetWindowText(edit2_c);
//获取数据
edit1(edit1_c.GetBuffer(0));
edit2(edit2_c.GetBuffer(0));
//把CString转换成string
ofstream outfile("data.dat",ios::out);//VC++6.0不要求写ios::out,写了反而报错⊙﹏⊙b汗
outfile<<edit1<<" ";
outfile<<edit2<<" ";//不要漏了空格
outfile.close(); //用完了就要关掉
string edit1,edit2;
CString edit1_c,edit2_c;
GetDlgItem(IDC_EDIT1)->GetWindowText(edit1_c);
GetDlgItem(IDC_EDIT2)->GetWindowText(edit2_c);
//获取数据
edit1(edit1_c.GetBuffer(0));
edit2(edit2_c.GetBuffer(0));
//把CString转换成string
ofstream outfile("data.dat",ios::out);//VC++6.0不要求写ios::out,写了反而报错⊙﹏⊙b汗
outfile<<edit1<<" ";
outfile<<edit2<<" ";//不要漏了空格
outfile.close(); //用完了就要关掉
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询