CStdioFile类
参数内容:
第一个参数为路径+文件名,最后一个为错误出现的结构.
现在解释下第二个参数
CFile::modeCreate Directs the constructor to create a new file. If the file exists already, it is truncated to 0 length.
指定构造器创建一个新的文件,如果文件已经存在,则内容截0.
CFile::modeNoTruncate Combine this value with modeCreate. If the file being created already exists, it is not truncated to 0 length. Thus the file is guaranteed to open, either as a newly created file or as an existing file. This might be useful, for example, when opening a settings file that may or may not exist already. This option applies to CStdioFile as well.
modeNoTruncate
假如你不用这个参数的话,用modeCreate模式创建和打开一个文件,假如这个文件已经存在,则会清空这个已经存在的文件,加上modeNoTruncate的话,就不会清空这个文件了
CFile::modeRead Opens the file for reading only.
只是以读取方式打开
CFile::modeReadWrite Opens the file for reading and writing.
读与写同时
CFile::modeWrite Opens the file for writing only.
只写
CFile::modeNoInherit Prevents the file from being inherited by child processes.
阻止这个文件被子进程继承
CFile::shareDenyNone Opens the file without denying other processes read or write access to the file. Create fails if the file has been opened in compatibility mode by any other process.
打开这个文件同时允许其它进程读写这个文件。如果文件被其它进程以incompatibility模式打开,这是create操作会失败。
CFile::shareDenyRead Opens the file and denies other processes read access to the file. Create fails if the file has been opened in compatibility mode or for read access by any other process.
打开文件拒绝其它任何进程读这个文件。如果文件被其它进程用compatibility模式或者是读方式打开,create操作失败。
CFile::shareDenyWrite Opens the file and denies other processes write access to the file. Create fails if the file has been opened in compatibility mode or for write access by any other process.
打开文件拒绝其它任何进程写这个文件。如果文件被其它进程用compatibility模式或者是写方式打开,create操作失败。
CFile::shareExclusive Opens the file with exclusive mode, denying other processes both read and write access to the file. Construction fails if the file has been opened in any other mode for read or write access, even by the current process.
以独占方式打开这个文件,不允许其它进程读写这个文件。
CFile::shareCompat This flag is not available in 32 bit MFC. This flag maps to CFile::shareExclusive when used in CFile::Open.
这个标志在32位的MFC中无效。
CFile::typeText Sets text mode with special processing for carriage return–linefeed pairs (used in derived classes only).
CFile::typeText 设置成对回车换行对有特殊处理的文本模式(仅用在派生类中)
CFile::typeBinary 设置二进制模式(仅用在派生类中)
CStdioFile继承自CFile,一个CStdioFile 对象代表一个用运行时函数fopen 打开的C 运行时流文件。
CStdioFile类相关推荐
- CStdioFile类学习
CStdioFile 类学习笔记 2007-7-17 CStdioFile 类的声明保存再 afx.h 头文件中. CStdioFile 类继承自 CFile 类, CStdioFile 对象表示一个 ...
- Cstdiofile类详解
CStdioFile类的声明保存在afx.h头文件中. CStdioFile类继承自CFile类,CStdioFile对象表示一个C运行函数fopen打开的的流式文件.流式文件是被缓冲的,而且可以以文 ...
- Win32中MFC中的CStdioFile类
CStdioFile类 它是继承CFile类的 class CStdioFile : public CFile,为什么需要一个CStdioFile类,封装来封装去不麻烦的吗,我一开始是这样想着的.我第 ...
- 利用CStdioFile类实现写文件读文件(mfc)
文章目录 1.主要函数 1.1读文件 1.2写文件 2.补充知识 3.说明 二话不说,先上代码! 1.主要函数 1.1读文件 // TODO: 在此添加控件通知处理程序代码CFileDialog dl ...
- 将CStdioFile类扩展,读取UNICODE文本文件
最近因为要读取SQL脚本文件,用CStdioFile来读取脚本文件,却在程序调试时读取不了文件. 后来看了一下文本文件格式,竟然是UNICODE格式的,原来在导出SQL脚本的时候,选项默认的是UNIC ...
- 判断CStdioFile的类成员有没有打开
判断CStdioFile的类成员有没有打开 说明 最后 说明 使用CStdioFile处理文件的时候,有时候遇到一个CStdioFile类,不知道该类有没有打开文件,此时贸然使用Open试图打开文件时 ...
- CFile和CStdioFile的区别以及‘\r’、‘\r\n’
转自:http://blog.csdn.net/davidhsing/archive/2007/08/26/1759494.aspx MSDN: Difference between text mod ...
- CFile、CStdioFile、FILE和其他文件操作(转)
CFile //创建/打开文件 CFile file; file.Open(_T("test.txt"),CFile::modeCreate|CFile::modeNoTrunca ...
- CFile、CStdioFile、FILE和其他文件操作
CFile //创建/打开文件 CFile file; file.Open(_T("test.txt"),CFile::modeCreate|CFile::modeNoTrunca ...
最新文章
- TVM darknet yolov3算子优化与量化代码的配置方法
- 网络推广专员浅析网站优化导航栏该怎样设置?
- Vue-resource中post请求将data数据以request payload转换为form data的形式
- SQL注入到EXP编写
- lightgbm 数据不平衡_不平衡数据下的机器学习(下)
- 一道C#类型转换的思考题
- vue-router向子组件传递参数
- linux mint 安装java_Linux mint 安装步骤
- webbench接口并发测试
- dataframe groupby_详解pandas中的map、apply、applymap、groupby、agg.
- radiogroup多选_Android实现单项、多项选择操作
- iOS:Autolayout自动布局实例
- Django模板实现地址的省市县三级联动
- 更新python pip 时提示操作超时错误
- 信息 按顺序打印commit_风火快递单打印软件按导入数据顺序批量打印,但打出来的顺序和导入的表格里的?...
- 对话冉小波:NULS三年来的实战心得与反思 |链捕手
- Mac 更新系统后无法使用git
- GitHub 上超屌的 9 个 Vue 开源项目
- Vue3的filter过滤器代替方法
- Win10企业版激活
热门文章
- 数字信号处理专业术语翻译
- 均值不等式的来龙去脉
- IDEA —— Debug调试模式
- cf_332b - Maximum Absurdity
- 【Allegro_SPB_16.6安装详细教程】手把手搭建到Win10
- php fflush失败,php fflush 函数_PHP教程
- 微信支付『支付失败,如果已扣款,资金在0-3个工作日原路返回』踩坑案例及解决方案
- 376招募线上被试 | 你对“中文句子”的记忆情况如何?
- 计算机无法以管理员模式运行,电脑为什么没法以管理员身份运行软件
- 先验概率、最大似然估计、贝叶斯估计、最大后验概率