Being a novice myself, I am not 100% sure if I am doing right either, but
here is
what I usually do:
MemHandle myArrayH = NULL;
...
Err err;
i = getSizeOfObject ( myObject );
if ( myArrayH == NULL )
myArrayH = MemHandleNew ( i * NUM_ITEMS_YOU_WANT );
else
myArrayH = MemHandleResize ( i * NUM_ITEMS_YOU_WANT );
when you want to use this array, you must lock and cast it like this:
MyObjectType* myObjArray;
myObjArray = (MyObjectType*)MemHandleLock ( myArrayH );
myObjArray[i].foo = bar;
...
MemHandleUnlock ( myArrayH ) ;
I haven't compiled the code above to see if this works.. but I hope you get
the idea.
MemHandleResize will resize an allocated memory chunk. If anyone sees
something
I am doing wrong, please let me know so that I can fix in my code too =)
-Ji
"Laor, Boaz" <[EMAIL PROTECTED]> wrote in message
news:42533@palm-dev-forum...
>
> lets say i am getting the size of my object in a functions call,
>
> Int8 i = 0;
>
> i = getSizeOfObject(myObject);
>
> and now i want to make an array of that size, however declaring new arrays
> in the middle of the code is a syntax error. what is the best way to do
> this. I don't know if if database is the right thing to implement for
this
> application. The choice is either a static predefined array or somehow
> resizing the array to the size of the object. what do you guys think?
>
> boaz
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/