Re: Pointers and offsets

2015-01-14 Thread ketmar via Digitalmars-d-learn
On Wed, 14 Jan 2015 01:16:52 + Bauss via Digitalmars-d-learn wrote: > Is it possible to access a pointer by its offsets. > Ex. write a 32bit integer to a byte pointer at ex. offset 4. yes, it is. it's same as in c/c++, except that you have to add one magic word: `cast`. D specs has it all.

Re: Pointers and offsets

2015-01-13 Thread Mike Parker via Digitalmars-d-learn
On 1/14/2015 10:17 AM, Bauss wrote: On Wednesday, 14 January 2015 at 01:16:54 UTC, Bauss wrote: Is it possible to access a pointer by its offsets. Ex. write a 32bit integer to a byte pointer at ex. offset 4. To give an example in C# you can do this: fixed (byte* Packet = Buffer) // Buffer would

Re: Pointers and offsets

2015-01-13 Thread Bauss via Digitalmars-d-learn
On Wednesday, 14 January 2015 at 01:16:54 UTC, Bauss wrote: Is it possible to access a pointer by its offsets. Ex. write a 32bit integer to a byte pointer at ex. offset 4. To give an example in C# you can do this: fixed (byte* Packet = Buffer) // Buffer would be a byte array And then to set the