Kerry,

I ran into similar problems when creating dynamic object lists. I
implemented long (dynamic) strings the same way.

Use MemHandleNew and MemHandleFree instead of MemPtrNew and MemPtrFree.
When you need to resize the piece of memory, call MemHandleResize.

The only real difference is you need to call MemHandleLock before, and
MemHandleUnLock after you access the memory. MemHandleLock accepts the
handle and returns a pointer to the memory.

Hope this helps

Regards,
Matt Parker


"Kerry Twibell" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I'm having problems re: allocating memory for dynamic
> strings. My application does a lot of string parsing,
> and I don't know how large strings will be in advance.
>
>
> I've been using the function
> "MemPtrNew(StrLen(charsP)) - this way, I don't
> allocate too much or too little memory. Is this the
> correct way to allocate memory for Char strings?  I've
> tried "MemPtrNew(sizeof(charsP)),"
> "MemPtrnew(sizeof(*charsP))" and
> "MemPtrNew(*charsP)," but all seem to fail.
>
>
> =====
> Kerry L. Twibell
> Computer Systems Engineer
> [EMAIL PROTECTED]
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to