Translation Mode Constants


The new home for Visual Studio documentation is Visual Studio 2017 Documentation on

The latest version of this topic can be found at Translation Mode Constants.


#include <fcntl.h>  

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:

Opens file in text (translated) mode. Carriage return – linefeed (CR-LF) combinations are translated into a single linefeed (LF) on input. Linefeed characters are translated into CR-LF combinations on output. Also, CTRL+Z is interpreted as an end-of-file character on input. In files opened for reading and reading/writing, fopen checks for CTRL+Z at the end of the file and removes it, if possible. 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.

Opens file in binary (untranslated) mode. The above translations are suppressed.

Same as _O_BINARY. Supported for C 2.0 compatibility.

For more information, see Text and Binary Mode File I/O and File Translation.

_open, _wopen
_sopen, _wsopen
Global Constants