--- Leander Druwel wrote:
> typedef Char* PackedRecordPtr;
> ...
> #define PACKED_TEXT(packRec) ((Char*)(packRec +
> StrLen(packRec +1))
> ...
>  SetFieldText (DetailTextField,
> PACKED_TEXT(packedPinRecPtr));
> ...
> What do I have to change???
> 

First, your #define for PACKED_TEXT is missing one
parenthesis.

Second, in your #define, (packRec +1) is doing pointer
arithmetic.  Since packRec is a Char*, adding one to
it adds sizeof(Char) bytes to the address.  That does
not point to the start of the third string.

One way you could do this is:

#define PACKED_PIN(packRec) ((Char*)(packRec +
StrLen(packRec)+1))
#define PACKED_TEXT(packRec) ((Char*)(packRec +
StrLen(packRec) + StrLen(PACKED_PIN(packRec)) + 2))

However, I would just write a function to parse the
three strings.  Writing a macro that includes another
macro opens the door to too many errors (at least it
does for me!)


__________________________________________________
Do You Yahoo!?
Buy the perfect holiday gifts at Yahoo! Shopping.
http://shopping.yahoo.com

-- 
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