stdin/stdout on Windows; so add a new system function called sys_setbinarymode which does it instead. Then find lots more binary mode flags which need setting.