_fmode

The _fmode variable sets the default file-translation mode for text or binary translation. It is declared in STDLIB.H as

extern int _fmode;

The default setting of _fmode is _O_TEXT for text-mode translation. _O_BINARY is the setting for binary mode.

You can change the value of _fmode in either of two ways:

  • Link with BINMODE.OBJ. This changes the initial setting of _fmode to _O_BINARY, causing all files except stdin, stdout, and stderr to be opened in binary mode.

  • Change the value of _fmode directly by setting it in your program.