Is there a function that reads the entire contents of a std.stdio.File?

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 16 08:50:13 PDT 2014


On Tuesday, 16 September 2014 at 14:59:45 UTC, Jay wrote:
> On Tuesday, 16 September 2014 at 14:43:10 UTC, Marc Schütz 
> wrote:
>> You could try `std.mmfile.MmFile`, it has a constructor that 
>> takes a `File`, but only on Linux:
>>
>> http://dlang.org/phobos/std_mmfile.html
>> https://github.com/D-Programming-Language/phobos/blob/master/std/mmfile.d#L77-L79
>
> does it work with pipes/sockets? it seems to call fstat() to 
> get the size of the contents. but anyway this is quite useful, 
> thanks.

mmap(2) says it fails with EACCES when the fd isn't a regular 
file, so unfortunately it won't work.


More information about the Digitalmars-d-learn mailing list