On Fri, 06 Jun 2003 15:01:45 -0500, denni wrote: > > > Char * pChar = (Char*)MemPtrNew(5 * sizeof(Char*)); > StrCopy(pChar, "Orders\0"); > > You have not allocated sufficient space in pChar. > > You probably don't want to say "5 * sizeof(Char *)" as this allocates space > for 5 pointers to characters. The base item is (char) not (char *). Also, > "Orders\0" is eight characters long. You probably don't want the explicit > \0 since the string constant "Orders" includes a \0 already. Time to grab a > C++ manual... >
just for the sake of correctness: the allocation was actually enough (although by accident). sizeof(Char*) evaluates to 4. so he allocated 20 bytes, which is enough. nevertheless this ( sizeof(type*) instead of sizeof(type)) is a bug/typo, which is sometimes hard to find. Sebastian -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/