翻译模式常量Translation Mode Constants

语法Syntax


#include <fcntl.h>  

备注Remarks

_O_BINARY_O_TEXT 清单常数将决定文件(_open_sopen)的转换模式或流 (_setmode) 的转换模式。The _O_BINARY and _O_TEXT manifest constants determine the translation mode for files (_open and _sopen) or the translation mode for streams (_setmode).

允许的值包括:The allowed values are:

_O_TEXT
在文本(已转换)模式下打开文件。Opens file in text (translated) mode. 输入时回车-换行符 (CR-LF) 组合将转换为单个换行符 (LF)。Carriage return - linefeed (CR-LF) combinations are translated into a single linefeed (LF) on input. 输出时换行符将转换为 CR-LF 组合。Linefeed characters are translated into CR-LF combinations on output. CTRL+Z 也将在输入时解释为文件尾字符。Also, CTRL+Z is interpreted as an end-of-file character on input. 在打开以进行读取或读取/写入的文件中,fopen 将检查文件末尾的 Ctrl+Z 并在可能的情况下将其移除。In files opened for reading and reading/writing, fopen checks for CTRL+Z at the end of the file and removes it, if possible. 这样做是因为,使用 fseekftell 函数在以 Ctrl+Z 结尾的文件中移动时,可能导致 fseek 在文件末尾附近错误操作。This is done because using the fseek and ftell functions to move within a file ending with CTRL+Z may cause fseek to behave improperly near the end of the file.

_O_BINARY
在二进制(未转换)模式下打开文件。Opens file in binary (untranslated) mode. 禁止上述的转换。The above translations are suppressed.

_O_RAW
_O_BINARY 相同。Same as _O_BINARY. 支持 C 2.0 兼容性。Supported for C 2.0 compatibility.

有关详细信息,请参阅文本和二进制模式文件 I/O文件转换For more information, see Text and Binary Mode File I/O and File Translation.

另请参阅See Also

_open、_wopen _open, _wopen
_pipe _pipe
_sopen、_wsopen _sopen, _wsopen
_setmode _setmode
全局常量Global Constants