D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 10545 - Mostly portable way to set stdout/stdin mode
Summary: Mostly portable way to set stdout/stdin mode
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: All All
: P4 enhancement
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-04 17:25 UTC by bearophile_hugs
Modified: 2024-12-01 16:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2013-07-04 17:25:52 UTC
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 dlangBugzillaToGithub 2024-12-01 16:18:10 UTC
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