- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
vc编程中的文件操作(Fileoperationsinvcprogramming)
vc++编程中的文件操作(File operations in vc++ programming)
1. file search
When working on a file, if you do not know whether the file exists, you must first look for it. In MFC, there is a class CFileFind that is used for file lookups. It can be used to search files conveniently and quickly. The following code demonstrates the most basic use of this class.
CString strFileTitle;
CFileFind finder;
BOOL bWorking = finder.FindFile (C:Windowssysbkup*.cab);
While (bWorking)
{
BWorking=finder.FindNextFile ();
StrFileTitle=finder.GetFileTitle ();
}
2. file open / save dialog box
When a user selects files for opening and storage operations, the file open / save dialog box is used. MFCs class CFileDialog is used to implement this functionality. Use the CFileDialog statement on an object, the first BOOL type parameter is used to specify the file to open or save, when TRUE will construct a file open dialog box, to construct a file dialog box for FALSE.
In the construction of the CFileDialog object, if the OFN_ALLOWMULTISELECT style specified in the parameter, this dialog box can be selected to operate. At this time we should pay attention to the CFileDialog object m_ofn.lpstrFile is used to allocate a block of memory, all the file path name returned by multiple storage operation, if not too small will be assigned or allocated memory operation failed. The following procedure demonstrates how to use the file open dialog box.
CFileDialog, mFileDlg (TRUE, NULL, NULL, OFN_HIDEREADONLY|OFN_OVER
WRITEPROMPT|OFN_ALLOWMULTISELECT, All Files, |*.*| | (. *) (AfxGetMainWnd));
CString str (, 10000);
MFileDlg.m_ofn.lpstrFile=str.GetBuffer (10000);
Str.ReleaseBuffer ();
POSITION, mPos=mFileDlg.GetStartPosition ();
CString pathName (, 128);
CFileStatus status;
While (mPos, =NULL)
{
PathName=mFileDlg.GetNextPathName (mPos);
CFile:: GetStatus (pathName, status);
}
3. read and write files
Document reading and writing is very important, the following will focus on introduction. The most common way to read
您可能关注的文档
- 20120927-问答广告策略-xmm(20120927- question and answer advertising strategy -xmm).doc
- 20121012系统集成项目管理工程师总结(20121012 systems integration project management engineer summary).doc
- 20101213年终压力最大十大职业排行(20101213 year-end pressure ten largest occupation ranking).doc
- c游戏编程(C game programming).doc
- c程序设计笔试题(C programming written examination questions).doc
- c编程2(C programming 2).doc
- c编译mysql(C compiles MySQL).doc
- c网和g网概念(The concepts of C nets and G nets).doc
- c语言 条件编译详解(C language conditions compile detailed).doc
- c语言变量名定义(C language variable name definition).doc
- vc6.0编译器参数设置(VC6.0 compiler parameter settings).doc
- vb实现在pc上通过手机发短消息(VB implements short messages on the PC via mobile phones).doc
- vb属性方法中英文对照(VB property method in English and Chinese).doc
- vc6编译参数的设置(VC6 compile parameter settings).doc
- vc6.0编译器详解(VC6.0 compiler detailed).doc
- vc下的ado编程入门(Introduction of ADO programming under VC).doc
- vcd机检修实例集粹(二)(VCD machine maintenance example Jicui (two)).doc
- vc下利用proc开发oracle接口(Using proc to develop Oracle interface under VC).doc
- vc定义的三种类型dll有什么区别(What are the differences between the three types of DLL defined by VC).doc
- vc常见编译错误(VC common compile errors).doc
最近下载
- 2023海南省邮政业安全保障中心招聘事业编制工作人员12人笔试备考题库及答案解析.docx VIP
- 第2章红外谱图解析习题课第章红外谱图解析习题课第2章红外谱图解析习题课第2章红外谱图解析习题课.ppt VIP
- 第七届全市职业技能大赛整理收纳师技术文件.docx VIP
- 化工污染物石油化工清洁生产94课件.pptx VIP
- 北京-LITE-产品使用说明书-引力版-BJ7000KPCC-BEV-LITE纯电动汽车产品使用说明书.pdf VIP
- 公共资源考试试题及答案.doc VIP
- 红外谱图解析习题课.pptx VIP
- CNAS-GL047-2021 医学实验室定量检验程序结果可比性验证指南.docx VIP
- 2025海南省邮政业安全保障中心招聘事业编制人员4人(第1号)笔试备考试题及答案解析.docx VIP
- 绿色化学与清洁生产.pptx VIP
文档评论(0)