Comment #0 by bearophile_hugs — 2013-07-04T17:25:52Z
In Phobos I'd like a (portable across different operating systems) way to set the mode of stdout/stdin (to binary or text mode).
A not portable way to do in C on Windows is:
setmode(fileno(stdout), O_BINARY);
In Python a not portable way to do it is (works on Windows):
import os, msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
I think an almost portable way to do it is (this is a C99 version of freopen):
freopen(null, "wb", stdout);
Comment #1 by robert.schadek — 2024-12-01T16:18:10Z