关于CString中的'/r/n',以及CFile和CStdioFile的讨论
2006-11-08 23:43
417 查看
CStdioFile::ReadString
ps: Difference between text mode file and binary mode file
File I/O operations take place in one of two translation modes, text or binary, depending on the mode in which the file is opened. Data files are usually processed in text mode. To control the file translation mode, you can:
a. Retain the current default setting and specify the alternative mode only when you open selected files.
b. Change the default translation mode directly by setting the global variable _fmode in your program. The initial default setting of _fmode is _O_TEXT, for text mode.
Text mode provides special processing for carriage return–linefeed pairs. When you write a newline character (0x0A) to a text-mode CStdioFile object, the byte pair (0x0D, 0x0A) is sent to the file. When you read, the byte pair (0x0A, 0x0D) is translated to a single 0x0A byte.
这几段MSDN中的文字(来自主题:CStdioFile::ReadString)说明的问题是:
CFile类操作文件默认的是Binary模式,CStdioFile类操作文件默认的是Text模式。
在Binary模式下我们必须输入'/r/n',才能起到回车换行的效果,'/r'只是回车(回到当前行的第一列),'/n'只是换行(到达下一行的当前列)。
而在Text模式下'/r'的工作是自动完成的,当我们写一个'/n'的时候,系统会自动帮我们在其前面加上一个'/r',然后保存到文件里。
另外,CFile::typeText只能在CFile的子类中使用,CFile自身的Read函数不能使用CFile::typeText和CFile::typeBinary
MSDN: CStdioFile::ReadString
Note: The CString version of this function removes the '/n' if present; the LPTSTR version does not.
ps: Difference between text mode file and binary mode file
File I/O operations take place in one of two translation modes, text or binary, depending on the mode in which the file is opened. Data files are usually processed in text mode. To control the file translation mode, you can:
a. Retain the current default setting and specify the alternative mode only when you open selected files.
b. Change the default translation mode directly by setting the global variable _fmode in your program. The initial default setting of _fmode is _O_TEXT, for text mode.
Text mode provides special processing for carriage return–linefeed pairs. When you write a newline character (0x0A) to a text-mode CStdioFile object, the byte pair (0x0D, 0x0A) is sent to the file. When you read, the byte pair (0x0A, 0x0D) is translated to a single 0x0A byte.
这几段MSDN中的文字(来自主题:CStdioFile::ReadString)说明的问题是:
CFile类操作文件默认的是Binary模式,CStdioFile类操作文件默认的是Text模式。
在Binary模式下我们必须输入'/r/n',才能起到回车换行的效果,'/r'只是回车(回到当前行的第一列),'/n'只是换行(到达下一行的当前列)。
而在Text模式下'/r'的工作是自动完成的,当我们写一个'/n'的时候,系统会自动帮我们在其前面加上一个'/r',然后保存到文件里。
另外,CFile::typeText只能在CFile的子类中使用,CFile自身的Read函数不能使用CFile::typeText和CFile::typeBinary
MSDN: CStdioFile::ReadString
Note: The CString version of this function removes the '/n' if present; the LPTSTR version does not.
相关文章推荐
- 关于CString中的'/r/n',以及CFile和CStdioFile的讨论。
- CFile 和 CStdioFile 区别以及 CString 中的 '/r/n'
- MSDN:CFile和CStdioFile区别以及CString中的'\r\n'
- 与江岭师弟的讨论 - 关于形式化逻辑的局限以及其它
- 关于C++虚函数,纯虚函数以及模板等重要概念的深入讨论(三)
- solr中一个问题——顺便讨论java中关于中包括main函数以及涉及资源(变量)操作中的类
- 关于String a=“”以及new String()和==以及equals的讨论
- 尽管关于Java中文问题的讨论已经相当多了,但由于Java的相关技术标准繁多,面向Java的Web服务器、应用服务器以及JDBC数据库驱动等都没有官方的标准,所以Java应用在处理中文时所存在的问
- 关于C++虚函数,纯虚函数以及模板等重要概念的深入讨论(一)
- 关于C++虚函数,纯虚函数以及模板等重要概念的深入讨论(二)
- 关于 rails ActiveRecord 属性 以及 foreign_key 不直接用数据库项目 时的一些讨论
- CFile和CStdioFile的区别以及‘\r’、‘\r\n’
- (转)总结一下最近关于domain object以及相关的讨论(来自JavaEye,作者robin)
- 判断链表是否为回文串以及关于回文串问题的讨论
- 关于CFile读取文件的问题GetLength(),,,万恶的CFile不如|CStdioFile
- 关于C++虚函数,纯虚函数以及模板等重要概念的深入讨论(一)
- 关于继承的讨论,以及私有属性继承的问题
- 关于C++虚函数,纯虚函数以及模板等重要概念的深入讨论(二)
- 百度搜索引擎的工作原理 鏀惰棌鍒帮細 时间:2015-07-10 文章来源:马海祥博客 访问次数:4330 关于百度以及其它搜索引擎的工作原理,其实大家已经讨论过很多,但随着科技的进步、互联网
- 总结一下最近关于domain object以及相关的讨论