Just create a global character pointer.
char * globalList;
then in your function allocate new memory.
if (globalList != NULL)
MemPtrFree(globalList);
globalList = MemPtrNew(DmRecordsInCategory(dbAuthors, dmAllCategories));
LstSetListChoices(ListPtr, globalList, iNumAuthors);
But don't forget to do the error checking, and freeing up the memory.
Craig
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Phillip
Koebbe
Sent: Monday, January 22, 2001 8:49 AM
To: Palm Developer Forum
Subject: Dynamic Size of array
Is it possible to create an array that on each execution of the method it
is potentially a different size? For example, let's say I've got a
database of authors. On my form, I want to have a list box to display all
of the authors. To use LstSetListChoices, I have to pass it an array. I
would rather not have a constant define the size of the array because then
I would have to tell the user "There is a limit of x authors." I want it
to be unlimited. Here's what I want to do (conceptually):
static void LoadAuthors(void)
{
...
// query database to see how many authors there are
iNumAuthors = DmRecordsInCategory(dbAuthors, dmAllCategories);
// instantiate the array
Char* AuthorList[iNumAuthors - 1];
...
LstSetListChoices(ListPtr, AuthorList, iNumAuthors);
}
But that doesn't work. Is there a way to accomplish this?
Thanks,
Phillip
--
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/