Bug 10545 – Mostly portable way to set stdout/stdin mode

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-04T17:25:52Z
Last change time
2024-12-01T16:18:10Z
Assigned to
No Owner
Creator
bearophile_hugs
Moved to GitHub: phobos#9988 →

Comments

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
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9988 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB