struct to byte[]

Hasan Aljudy hasan.aljudy at gmail.com
Wed Dec 13 04:04:36 PST 2006



Luís Marques wrote:
> Hello,
> 
> Converting a structure to ubyte[] or similar is something that I have 
> been doing frequently while converting C to D code.
> 
> Can we have a "cast(type[])" working for structures, please?
> 
> I suppose that type should include at least ubyte, byte and char, if not 
> all the basic data types.

Be careful with char: D char type is not a byte, it's a UTF-8 code unit. 
Don't try to use char[] for storing raw data.



More information about the Digitalmars-d mailing list