Laurence Lundblade <[EMAIL PROTECTED]> wrote:
> You sure about your offset? I usually do something like:
>
> struct xxx {
> char foo;
> long goo;
> char zoo[10];
> } yyy;
>
> const struct xxx *pNIL = (struct xxx *)NULL;
> const long offset = (unsigned long)&(pNil->zoo);
> DmWrite(ptr, offset, &yyy.zoo, 10);
>
> Really ugly, but not really any other way to get the compiler to tell you
> how it laid out the structure. (In this case the offset will be 2, not 1)
You could save a few lines of code by using the offsetof macro that's
defined in stddef.h.
DmWrite(ptr, offsetof(struct xxx, zoo), &yyy.zoo, 10);
--
Roger Chaplin
<[EMAIL PROTECTED]>