void CFile_wrDlg::OnBtnNew()
{
UpdateData();
m_name += ".txt";
CFile file(m_name,CFile::modeCreate | CFile::modeNoTruncate);
file.Close();
UpdateData(0);
MessageBox("创建成功!请查看当前目录");
}
void CFile_wrDlg::OnBtnWrite()
{
UpdateData();
CFile file(m_name,CFile::modeWrite);
file.SeekToEnd();
file.Write(m_edit1,strlen(m_edit1));
file.Close();
MessageBox("写入成功!");
}
void CFile_wrDlg::OnBtnRead()
{
CFile file(m_name, CFile::modeRead) ;
DWORD dwFileLen = file.GetLength();
char* p = new char[dwFileLen+1];
p[dwFileLen] = 0;
file.Read(p,dwFileLen);
file.Close();
MessageBox(p);
}
MFC的TXT
最新推荐文章于 2024-09-02 23:01:37 发布