On Saturday, March 10, 2018 19:22:43 Bogdan via Digitalmars-d-learn wrote:
> On Saturday, 10 March 2018 at 18:49:48 UTC, Jonathan M Davis
>
> wrote:
> > Check out
> >
> > https://dlang.org/phobos/std_bitmanip.html#peek
> > https://dlang.org/phobos/std_bitmanip.html#read
> >
> > They can be used to read integral values from a range of
> > ubytes. You can use either std.file.read or std.stdio.File to
> > read from the file and than those functions from std.bitmanip
> > to convert the ubytes to integrals. std.file.read would be the
> > easiest to use, since it just gives you a single dynamic array
> > to deal with, but it does mean reading in the entire file at
> > once.
>
> Yes, thank you! That's much better, even if the source buffer
> gets consumed.

read consumes and peek just looks, though you need random access to peek
beyond the front of the range.

- Jonathan M Davis

Reply via email to