void CTxtView::OnFileWrite()
{
// TODO: Add your command handler code here
CFile file("c:\\1.txt",CFile::modeCreate||CFile::modeWrite);
CArchive ar(&file,CArchive::store);
CString str="123";
// ar<<str;
// ar.Flush();
file.Write("123",3);
ar.Close();
file.Close();
}
void CTxtView::OnFileRead()
{
// TODO: Add your command handler code here
CString ch;
CFile file;
CFileException fe;
if (!file.Open("c:\\1.txt",CFile::modeRead,&fe))
{
fe.ReportError();
return;
}
CArchive ar(&file,CArchive::load);
ar>>ch;
MessageBox(ch);
ar.Flush();
ar.Close();
file.Close();
}