of course not!!no that wasn't the problem,even if i gave an array of
one[20]and gave the offsetof macro it was reading from the end of the first
four bytes.!!!however i did it withot using the offset macro.had to
calculate the offset and do it...i have found a solution but i still don't
know as to what caused the error for this.
thanks anyway.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Richard
Burmeister
Sent: Wednesday, July 04, 2001 5:44 PM
To: Palm Developer Forum
Subject: RE: offsetof MACRO
> From: Prashanth
>
> ... (UInt32)OffsetOf(myrecordtype,text)...
> myrecoredtype contains two char pointers of which
> text is the second one. the problem is the offset
> starts from 4 bytes after the first char pointer and
> not from the start of the second text pointer which
> has to be the case.
>
If your structure contains two pointers, each pointer *is* 4 bytes.
Example 1:
typedef struct {
Char * one;
Char * two;
} myStruct;
Then OffsetOf(myStruct, two) == 4
Example 2: (Is this what you thought you were doing?)
typedef struct {
Char one[10];
Char two[10];
} myStruct2;
Then OffsetOf(myStruct2, two) == 10.
If this explains your problem, then I think you should read a book on C to
learn more. If this isn't your problem, then you may have to post again
with some additional explanation of what you expect and how it didn't work.
--
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/