If at some point you need more (or find that you have more memory allocated than necessary) you can make a call to MemHandleResize() or MemPtrResize() to grow or shrink the chunk.
Hope that helps.
-Ben Bloomfield
On 1/13/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
Hi all,
I'm having a bit of difficulty figuring out how to allocate memory for a structure that contains an array of structures.
I found some sample code on how to allocate memory for such a setup, as follows:
pdat = (struct pdata *) MemPtrNew(sizeof(struct pdata));
pdat->idat = (struct idata *)MemPtrNew(5 * sizeof(struct idata));
This code will allocate a structure called pdat as well as allocate memory for an array of five idat structures within the pdat structure.
How would I go about allocating memory for this structure if I didn't know beforehand the number of idat structures will exist in the array? Or is this information absolutely required in order to do this?
Thanks.
--
For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
-- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
