Re: What is the D way to map a binary file to a structure?

2015-08-31 Thread cym13 via Digitalmars-d-learn
On Monday, 31 August 2015 at 01:01:32 UTC, mzf wrote: On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct

Re: What is the D way to map a binary file to a structure?

2015-08-30 Thread Atila Neves via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Re: What is the D way to map a binary file to a structure?

2015-08-30 Thread mzfhhhh via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread drug via Digitalmars-d-learn
29.08.2015 15:56, cym13 пишет: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier ulong pointsNumber;

What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier ulong pointsNumber; Point[] points; // Array of

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question at all. I'm not looking for a serialization method, I'm looking for the best way to read a binary file.

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 29 August 2015 at 14:52:51 UTC, drug wrote: 29.08.2015 17:17, cym13 пишет: On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question at all. I'm not looking for a

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread drug via Digitalmars-d-learn
29.08.2015 17:17, cym13 пишет: On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question at all. I'm not looking for a serialization method, I'm looking for the best way to read a

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread cym13 via Digitalmars-d-learn
On Saturday, 29 August 2015 at 16:47:23 UTC, Laeeth Isharc wrote: Align(1) ? That should do it, thanks :)

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread drug via Digitalmars-d-learn
29.08.2015 18:05, cym13 пишет: On Saturday, 29 August 2015 at 14:52:51 UTC, drug wrote: 29.08.2015 17:17, cym13 пишет: On Saturday, 29 August 2015 at 13:56:10 UTC, drug wrote: Try, for example, MessagePack https://github.com/msgpack/msgpack-d.git Thanks, but it isn't answering the question

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread Laeeth Isharc via Digitalmars-d-learn
On Saturday, 29 August 2015 at 12:56:08 UTC, cym13 wrote: Hi, Let's say I have a simple binary file whose structure is well-known. Here is an example which stores points: struct Point { long x; long y; long z; } struct BinFile { uintmagicNumber; // Some identifier

Re: What is the D way to map a binary file to a structure?

2015-08-29 Thread Suliman via Digitalmars-d-learn
On Saturday, 29 August 2015 at 16:55:44 UTC, cym13 wrote: On Saturday, 29 August 2015 at 16:47:23 UTC, Laeeth Isharc wrote: Align(1) ? That should do it, thanks :) Do not forget to post code example, please, it's interesting to look at your solution...