July 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10545

           Summary: Mostly portable way to set stdout/stdin mode
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2013-07-04 17:25:52 PDT ---
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);

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------