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 07:43:08 PDT 2014


On Tuesday, 16 September 2014 at 14:37:06 UTC, Jay wrote:
> all the functions/methods i've come across so far deal with 
> either streams or just file names (like std.file.read) and 
> there doesn't seem to be a way to wrap a std.stdio.File in a 
> stream (or is there?). i need a function that takes a 
> std.stdio.File and returns a string or byte array.

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


More information about the Digitalmars-d-learn mailing list