Ha! Ha! _read and _write aren’t binary!February 11, 2007 6:05 pm Erlang
… which screws you nicely for a while, while you’re trying to figure out what’s broken in your erlang port. Unfortunately, there doesn’t seem to be a portable solution. That said, here’s what you do in naively configured unhosted from-unix toolchains (eg DevKitPro):
freopen(NULL, "wb", stdin);
freopen(NULL, "wb", stdout);
And, in Windows:
_setmode( _fileno( stdin ) , _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
That should save you some pain.