At 01:41 AM 8/17/2004, you wrote:
>
>I have tried to use FtrPtrNew() in the code fragment below but the same
>crash occurs so I am wondering if I am missing something.
>
>char* pNew;
>FtrPtrNew(DB_CREATOR, 0, StrLen(TITLE) + 1, (void**)(&pNew));
>DmSet(pNew, 0, StrLen(TITLE) + 1, 0);
>DmWrite(pNew, 0, TITLE, StrLen(TITLE));
>FrmSetTitle(pForm, pNew);
>
>There are many improvements I could do to my code;

First improvement should be to check return codes. and find out why and when it breaks.
Also simplify the code
MemPtr memP;
Err err = FtrPtrNew(DB_CREATOR, 0, StrLen(TITLE) + 1, &memP);
if (!err) {
// error handling
} else {
DmWrite(memP, 0, TITLE, StrLen(TITLE) + 1);
FrmSetTitle(pForm, (Char *)memP);
}



Roger Stringer Marietta Systems, Inc. (www.rf-tp.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