titleItemList[i] = (char
*)MemPtrNew(StrLen(dbRecipePtr->title));
StrCopy(titleItemList[i], dbRecipePtr->title);
Simple example:
- we assume the title is "foo"
- then StrLen(title) is 3, right?
- so you allocate a buffer of 3 bytes
- then use StrCopy to copy "foo" into the buffer
But what about the trailing NULL-character that is copied with it? It
will bust your buffer, since StrCopy writes 4 characters in total.
I would write:
titleItemList[i] = (char)MemPtrNew(StrLen(dbRecipePtr->title) + 1);
This should eliminate the first errors. If it still crashes, mail again.
Thomas
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/