The code I'm writing has a variable decimal point, so I don't believe this
suits my needs. If I could get the exact string-length however, I can
correctly place the decimal based on the StrLen - #of decimals.
--
Tim Astle
James Parker <[EMAIL PROTECTED]> wrote in message
news:9442@palm-dev-forum...
>
> >How would I correctly allocate the exact amount of memory I require for a
> >string, based on an integer result?
> >
> >For example:
> >
> >char *s;
> >long int x = 12312451, y = 324324;
> >z = x + y;
> >
> >Now I need to place this result into a character array. Would I do this?
> >s = (char *)MemPtrNew(sizeof(z));
> >
> >I'm sure that isn't the correct way to do it, but I need to have the
> >information as exact as possible. I later use the information to
determine
> >the placement of a decimal in the array.
> >
> >--
> >
> >Tim Astle
>
> How about StrPrintF?
>
> StrPrintF(buf, "%d", z);
>
> Look it up in the Palm OS Reference for more info.
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html