CFile类的OPEN函数的第二个参数nOpenFlags一共可取哪些值呢?20分求教!

CYQ_96 2001-07-07 03:24:47
是否有文本方式和二进制的区别?
...全文
274 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
hyhong_h 2001-07-07
  • 打赏
  • 举报
回复
nOpenFlags

Sharing and access mode. Specifies the action to take when opening the file. You can combine options listed below by using the bitwise-OR (|) operator. One access permission and one share option are required; the modeCreate and modeNoInherit modes are optional. The values are as follows:

CFile::modeCreate Directs the constructor to create a new file. If the file exists already, it is truncated to 0 length.


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.


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.


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.


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.


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.


CFile::typeText Sets text mode with special processing for carriage return–linefeed pairs (used in derived classes only).


CFile::typeBinary Sets binary mode (used in derived classes only).

69,369

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧