It's just a global variable (extern int _fmode). One can just write "_fmode = _O_TEXT (or _O_BINARY). Since C++ 2005, though, it is recommended that one use _get_fmode and _set_fmode. You can also just link in Binmode.obj, which will set it to binary EXCEPT FOR operations involving stdin, stdout, and stderr.