[Issue 5190] New: std.stdio should have File.fdopen

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 9 01:25:35 PST 2010


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

           Summary: std.stdio should have File.fdopen
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: d-bugzilla at autark.se


--- Comment #0 from Per Ångström <d-bugzilla at autark.se> 2010-11-09 01:24:31 PST ---
As far as I can tell, struct File in std.stdio does not have a direct way to
construct a File object from a low-level file descriptor, à la fdopen.

I ran into this issue when using fork and pipe to create a pipe between two
processes; having started a child process I wanted to parse the child's
standard output using high-level File functions, and for that purpose I wanted
to create a File object from a file descriptor.

After some head-scratching, I was finally able to work around the issue by
extern-declaring fdopen and using the sparsely documented File.wrapFile
function (which is labelled "unsafe") to construct a File object, but that was
inconvenient and obscure.

Implementing fdopen in File would make systems programming with Phobos easier.

-- 
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