[Issue 9455] New: File.isBinaryMode and more

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 5 17:04:54 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9455

           Summary: File.isBinaryMode and more
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-02-05 17:04:53 PST ---
Some functions I write take a File reference and write some binary data on it.
So in their pre-condition I'd like to assert the File to be not just open, but
also opened in binary mode. I think currently there is no handy way to know if
a std.stdio.File is opened in binary or text mode (or in write or read mode).

After a short discussion on IRC #D with jA_cOp, I think a way to implement this
feature is:
- Add isBinaryMode/isWriteable/isReadable properties to File, and implement
them as light wrappers around platform-specific functions that get that
information.
- in most cases a std.stdio.File is created with a file name and a mode string,
while the usage of std.stdio.File.wrapFile() is uncommon. So on systems where
those platform-specific functions are not available a workaround is to keep
this mode string given to the File.__ctor.

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


More information about the Digitalmars-d-bugs mailing list