MFC输入的数据在文件中是乱码怎么解决???急求解答!!!
voidCMy1007830104Dlg::OnAdd(){//TODO:AddyourcontrolnotificationhandlercodehereUpdateD...
void CMy1007830104Dlg::OnAdd()
{
// TODO: Add your control notification handler code here
UpdateData();
person p1;
p1.xingming=m_name;
p1.xingbie=m_sex;
p1.birthday=m_birthday;
p1.city=m_city;
p1.workplace=m_wokplace;
p1.workphone=m_workphone;
p1.homephone=m_homephone;
p1.post=m_post;
p1.email=m_email;
CFile file;
CFileException FileE;
if (!file.Open(TEXT("e:\\list.txt"),CFile::modeReadWrite|CFile::modeCreate
|CFile::typeBinary|CFile::shareDenyNone,&FileE))
{
MessageBox("打开文件失败!");
exit(1);
}
// file.Write(&p1,sizeof(p1));
MessageBox("添加成功!");
Invalidate();
}
在对话框中输入数据后,打开文件,出来的都是乱码,怎么解决?拜托哪个大侠帮帮我吧,马上就得交了,就这个问题了... 展开
{
// TODO: Add your control notification handler code here
UpdateData();
person p1;
p1.xingming=m_name;
p1.xingbie=m_sex;
p1.birthday=m_birthday;
p1.city=m_city;
p1.workplace=m_wokplace;
p1.workphone=m_workphone;
p1.homephone=m_homephone;
p1.post=m_post;
p1.email=m_email;
CFile file;
CFileException FileE;
if (!file.Open(TEXT("e:\\list.txt"),CFile::modeReadWrite|CFile::modeCreate
|CFile::typeBinary|CFile::shareDenyNone,&FileE))
{
MessageBox("打开文件失败!");
exit(1);
}
// file.Write(&p1,sizeof(p1));
MessageBox("添加成功!");
Invalidate();
}
在对话框中输入数据后,打开文件,出来的都是乱码,怎么解决?拜托哪个大侠帮帮我吧,马上就得交了,就这个问题了... 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询