Text and Binary Mode File I/O (original) (raw)

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 often processed in text mode. To control the file translation mode, one can:

When you call a file-open function such as _open, fopen, fopen_s, freopen, freopen_s, _fsopen or _sopen_s, you can override the current default setting of _fmode by specifying the appropriate argument to the function _set_fmode. The stdin, stdout, and stderr streams always open in text mode by default; you can also override this default when opening any of these files. Use _setmode to change the translation mode using the file descriptor after the file is open.

See also

Input and output
Universal C runtime routines by category