cast

Max Samuha maxter at i.com.ua
Fri Nov 17 05:30:53 PST 2006


On Fri, 17 Nov 2006 14:01:50 +0100, Boris Shomodjvarac
<shomodj.N at SPAM.slashmail.org> wrote:

>
>Hi,
>
>I have a array of ubyte-s and need to cast for example from 4-th element
>to 8-th element into int, anyone knows how to do that? 
>
>example:
>
>ubyte buffer[1024];
>
>listener.receiveFrom(buffer, address);
>
>writefln("Transaction ID: %s", cast(int)buffer[4 .. 8]);
>
>
>Thanks.

*cast(int*)&buffer[4]
or
*cast(int*)(buffer.ptr + 4)







More information about the Digitalmars-d-learn mailing list