You need to provide a real chunk of memory big enough to hold the formatted
result in strP, *not* a null ptr.

So 

  strP = MemPtrNew(3); // or char[3] str, and then use &str in the call
below
  StrPrintF(strP, "%02x", hexval);

john Schettino
Palm OS Programming for Dummies, http://schettino.tripod.com

-----Original Message-----
From: Wang, Nancy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 05, 2000 4:32 PM
To: Palm Developer Forum
Subject: StrPrintF 


Hello,

  I remember some previous posting about StrPrintF crashes. I met the same
problem with the following code:

  CharPtr strP = NULL;
  Int16 hexval = 128;

  StrPrintF(strP, "%02x", hexval);

  Does someone know why it crashed? Thanks.

Nancy

-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to