--- Jeremy Bradshaw <[EMAIL PROTECTED]> wrote:
> Yeah, I typed it wrong. I used your function instead and
> it worked great.
> Didn't even have to initialize the attrs variable.
Well, my code *did* allocate space for the attrs variable.
Your code used
FieldAttrPtr attrs;
which allocates space for a pointer,
and my code used
FieldAttrType attrs;
which allocates space for a variable of type FieldAttrType. &attrs is
the address of (a pointer to) that block of memory, which is
sizeof(FieldAttrType) bytes. (It will actually be on the stack for a
local variable.)
As an alternative, you could use dynamic memory allocation like this:
FieldAttrPtr attrs;
attrs = MemPtrNew( sizeof(FieldAttrType) );
// free up the memory when done:
MemPtrFree( attrs );
If FieldAttrType was something big, this method would be preferable
because stack space is limited. But FieldAttrType is currently only 16
bits, so it is easier to just use a local, stack based, variable.
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/