Re: Consume binary files

2018-03-10 Thread Jonathan M Davis via Digitalmars-d-learn
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

Re: Consume binary files

2018-03-10 Thread Bogdan via Digitalmars-d-learn
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

Re: Consume binary files

2018-03-10 Thread Mark Fisher via Digitalmars-d-learn
On Saturday, 10 March 2018 at 18:26:43 UTC, Bogdan wrote: I'm working on a pet project which involves reading various structure types, or just multi-byte values (uin32_t, uint16_t, etc) from files, or just from ubyte arrays. I think you should use ranged types.

Re: Consume binary files

2018-03-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Saturday, March 10, 2018 18:31:23 Bogdan via Digitalmars-d-learn wrote: > ... I accidentally posted that before it was complete because I > kept pressing TAB in order to indent ... > > Anyway, I'd like to know if there exists such a thing as > > ``` > int a = stream.ReadInt32(); > ``` Chec

Re: Consume binary files

2018-03-10 Thread Bogdan via Digitalmars-d-learn
... I accidentally posted that before it was complete because I kept pressing TAB in order to indent ... Anyway, I'd like to know if there exists such a thing as ``` int a = stream.ReadInt32(); ```

Consume binary files

2018-03-10 Thread Bogdan via Digitalmars-d-learn
I'm working on a pet project which involves reading various structure types, or just multi-byte values (uin32_t, uint16_t, etc) from files, or just from ubyte arrays. Here's how I've been dealing with some of these situations so far: ``` /// Helper structure used to read each of the file