mfc中,生成时提示cfile不能将参数1从const char转换为lpctstr,还有operator =不明确是怎么回事?
代码如下voidCMfcdlg2014Dlg::OnButton1(){//TODO:AddyourcontrolnotificationhandlercodehereC...
代码如下
void CMfcdlg2014Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CFile f("文本文档.txt", CFile::modeCreate| CFile::modeNoTruncate | CFile::modeWrite);
CString s,s1,s2,s3;
GetDlgItemText(IDC_EDIT1, s1);
GetDlgItemText(IDC_EDIT2, s2);
GetDlgItemText(IDC_EDIT3, s3);
if(!(s1.GetLength()*s2.GetLength()*s3.GetLength()))
{
MessageBox(_T("请输入完整信息!"));
}
else
{
s = s1 + "|" + s2 + "|" + s3 + "\r\n";
}
f.SeekToEnd();
f.Write((LPCTSTR)s, s.GetLength());
f.Close();
} 展开
void CMfcdlg2014Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CFile f("文本文档.txt", CFile::modeCreate| CFile::modeNoTruncate | CFile::modeWrite);
CString s,s1,s2,s3;
GetDlgItemText(IDC_EDIT1, s1);
GetDlgItemText(IDC_EDIT2, s2);
GetDlgItemText(IDC_EDIT3, s3);
if(!(s1.GetLength()*s2.GetLength()*s3.GetLength()))
{
MessageBox(_T("请输入完整信息!"));
}
else
{
s = s1 + "|" + s2 + "|" + s3 + "\r\n";
}
f.SeekToEnd();
f.Write((LPCTSTR)s, s.GetLength());
f.Close();
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询