Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 2.18 KB

translation-mode-constants.md

File metadata and controls

49 lines (39 loc) · 2.18 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
Translation Mode Constants | Microsoft Docs
11/04/2016
cpp-standard-libraries
article
_O_BINARY
_O_TEXT
_O_RAW
C++
O_BINARY constant
O_TEXT constant
O_RAW constant
_O_TEXT constant
_O_RAW constant
translation constants
_O_BINARY constant
translation, constants
translation, modes
translation modes (file I/O)
a5993bf4-7e7a-47f9-83c3-e46332b85579
6
corob-msft
corob
ghogen

Translation Mode Constants

Syntax

  
#include <fcntl.h>  
  

Remarks

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. 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.

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

_O_RAW
Same as _O_BINARY. Supported for C 2.0 compatibility.

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

See Also

_open, _wopen
_pipe
_sopen, _wsopen
_setmode
Global Constants