If StrPrintF would accept a NULL destination but still return the correct
count of characters generated, this would be easy to implement.
Unfutunately, the current code does a StrLen on the string generated to get
the length). Just a suggestion for development

 -----Original Message-----
From:   Mark Nudelman [mailto:[EMAIL PROTECTED]]
Sent:   Wednesday, January 05, 2000 14:56
To:     [EMAIL PROTECTED]
Subject:        Re: StrPrintF

Um, but this code doesn't do anything.  Since "text" is allocated as the
same size as the input buffer (s), this doesn't provide any protection.
It just does an unnecessary StrNCopy.  You want to call MemPtrNew with a
LARGER size, a size that's large enough to handle any formatStr.
Unfortunately, there is no such size, so the best you can do is estimate
the largest size your app will need and use that.  It's unfortunate that
Palm didn't provide a printf-like variant that calls a callback function
to output each char into the buffer.  Then you could do a real
StrNPrintF without an extra buffer.  Of course, you could write your own
from scratch by duplicating all the logic in StrNPrintF.
--Mark


more - deleted

Reply via email to