摘要: void CTxtView::OnFileWrite() {// TODO: Add your command handler code hereCFile 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 C 阅读全文
posted @ 2013-04-06 11:40 qq921201008 阅读(388) 评论(0) 推荐(0)
摘要: 今日用CArchive练习流输入,不料输出结果有差异,未查明原因,特此记录void CTxtView::OnFileWrite() {// TODO: Add your command handler code hereCFile file("c:\\1.txt",CFile::modeCreate||CFile::modeWrite);CArchive ar(&file,CArchive::store);CString str="123";ar<<str; ar.Flush();//file.Write("123" 阅读全文
posted @ 2013-04-06 11:33 qq921201008 阅读(152) 评论(0) 推荐(0)
摘要: CFileException类的声明文件保存在头文件afx.h中。当我们在使用CFile及其派生类的对象的时候,如果产生异常则会创建和抛出CFileException对象。采用TRY…CATCH…END_CATCH。CFileException类的成员变量:m_cause:错误代码CFileException::none没有错误发生CFileException::generic一个未被指明的错误发生CFileException::fileNotFind该文件不能被定位CFileException::badPath整个或者部分路径是无效的CFileException::tooManyOpenFi 阅读全文
posted @ 2013-04-06 10:27 qq921201008 阅读(2463) 评论(0) 推荐(0)