I have access to OffsetOf() which was defined in PalmType.h. My problem here is
how to use it in my application.
-Elizabeth
|--------+----------------------->
| | Grounderyoyo2|
| | [EMAIL PROTECTED] |
| | |
| | 10/02/00 |
| | 05:11 PM |
| | Please |
| | respond to |
| | palm-dev-foru|
| | m |
| | |
|--------+----------------------->
>-----------------------------------------------------------|
| |
| To: [EMAIL PROTECTED] |
| cc: |
| Subject: Re: How to update a specified field in |
| the database |
>-----------------------------------------------------------|
In a message dated 10/2/00 6:07:57 PM Mountain Daylight Time,
[EMAIL PROTECTED] writes:
> I can't use offsetof() in my application. My StructType is defined as
> typedef struct {
> UInt32 Id1;
> UInt32 Id2;
> char Data[1];
> } StructType;
>
> I can use offsetof(StructType, Id1) to write to the first field, but how
can
> I
> update data in the 5th field (also have to consider there is also data in
> the
> sixth field and new data might have a different size)?
I heard that 'offsetof' isn't included in whatever it needs to be included
in, so you need to put this in your .h file:
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
so that the Palm knows what you're doing. Is this right?
( }#^} Ritz
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/