Using array slices with C-style fread() from file

tetyys via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 21 12:02:32 PDT 2017


On Wednesday, 21 June 2017 at 18:58:58 UTC, tetyys wrote:
> On Wednesday, 21 June 2017 at 18:49:01 UTC, uncorroded wrote:
>> Is there a way of making this work with D slices? Can they be 
>> used as C-style pointers?
>
> What about this
>

Or simpler,

while (left)
     left -= fread(buf[n-left .. $].ptr, ubyte.sizeof, left, fp);


More information about the Digitalmars-d-learn mailing list