> From: Alfred Wallner
>
> struct Record {
>               UInt16 a;
>               UInt16 b;
>               UInt8 c;
>               UInt16 d;
> } ixRec;
> [snip]
>
> >From my record structure, I picked 5 as the byte offset value
> for DmWrite, but that doesn't work, so I have to pick offset 6,
> which is the low byte of the UInt16 field.
>

Your compiler is probably packing the structure to word-align the members.

If you want to use a mixture of word and byte vars, put the byte vars at the
end.  E.g.,
struct Record {
        UInt16 a;
        UInt16 b;
        UInt16 d;
        UInt8 c;
} ixRec;

Or, pack it yourself, as in:
struct Record {
        UInt16 a;
        UInt16 b;
        UInt8 c;
        UInt8 filler;
        UInt16 d;
} ixRec;


Or, use the offsetof macro to determine where things actually are.


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to