Steven Schveighoffer:

In C++ you use something like:

setmode(fileno(stdout), O_BINARY);

(I don't even know where to find O_BINARY in core.stdc).

It may not be present, but it's just a number.  Look it up.

Adding a hardcoded magic number in my code isn't very good.

setmode() should be in unistd.h, but I can't import core.stdc.unistd (and I don't find it in std.c.windows.windows).

fileno() should be in std.stdio or core.stdc.stdio, but I can't find it.


In Python I use:

import os, msvcrt
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)

Bye,
bearophile

Reply via email to