为什么打开记事本看的时候总是多了一些乱码出来呢.
请大家帮我看看啊.为什么打开记事本看的时候总是多了一些乱码出来呢. 先谢谢了.CInsert dlg;
CFile file;
CFileDialog DLG(TRUE,".TXT",NULL,NULL,"*TXT");
if(DLG.DoModal()==IDOK)
{
m_path=DLG.GetPathName();
}
if(dlg.DoModal()==IDOK)
{
note *p=new A;
strcpy(p->Name,dlg.m_name);
strcpy(p->Tel,dlg.m_tel);
strcpy(p->Address,dlg.m_address);
strcpy(p->QQ,dlg.m_qq);
strcpy(p->Email,dlg.m_email);
if(pHead==NULL)
{
pHead=pEnd=p;
p->Next=NULL;
}
else
{
pEnd=p;
p->Next=NULL;
}
if(!file.Open(m_path,CFile::modeCreate | CFile::modeWrite))
{
MessageBox("Can not open the file");
return;
}
int len=sizeof(A);
note *pnew=new A;
strcpy(pnew->Name,pEnd->Name);
strcpy(pnew->Tel,pEnd->Tel);
strcpy(pnew->Address,pEnd->Address);
strcpy(pnew->QQ,pEnd->QQ);
strcpy(pnew->Email,pEnd->Email);
file.Write(p,len);
}
file.Close();
}