Andreas Müller wrote:
> I'm designing a new simple protocol and now I need a header for it.
> There should only be 3 fields, one 32bit and 2 16bit fields -> 64bit
> header (8byte). Due to the used library I need the data as a (unsigned
> char*) for delivering. I thought about a struct to store the header but
> I don't know how to cast it to the expected format for delivering.
> Is there a way to store all this information and deliver it in a char[8]
> which would be exactly 8byte long?
Just use a char [8], or better, unsigned char [8] Put/get your data in it in
the format you want to use, and the code will work in all machines (in all
that use the same byte size, at least).
--
Salu2
|