MFC Edit Box中信息怎么写入文本TXT中
1个回答
展开全部
CFileDialog fileDlg(FALSE);
fileDlg.m_ofn.lpstrTitle = "保存";
fileDlg.m_ofn.lpstrFilter = "Test File(*.txt)\0*.txt\0All File(*.*)\0*.*\0\0";
fileDlg.m_ofn.lpstrDefExt = "txt";
if (IDOK == fileDlg.DoModal())
{
CString str;
GetDlgItemText(Edit控件资源号,str);
CFile file(fileDlg.GetFileName(),CFile::modeCreate|CFile::modeWrite);
file.Write(str,str.GetLength());
file.Close();
}
fileDlg.m_ofn.lpstrTitle = "保存";
fileDlg.m_ofn.lpstrFilter = "Test File(*.txt)\0*.txt\0All File(*.*)\0*.*\0\0";
fileDlg.m_ofn.lpstrDefExt = "txt";
if (IDOK == fileDlg.DoModal())
{
CString str;
GetDlgItemText(Edit控件资源号,str);
CFile file(fileDlg.GetFileName(),CFile::modeCreate|CFile::modeWrite);
file.Write(str,str.GetLength());
file.Close();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询