Yup, always getting that 4 bytes :-)
--
Tim Astle
Michael Yam <[EMAIL PROTECTED]> wrote in message
news:9452@palm-dev-forum...
>
> It won't work. I'm assuming you've declared z as a long int and that you
> want to allocate the number of digits in a character buffer. Well,
> sizeof(z) will most likely return 4 bytes (depending on your platform)
which
> isn't enough to hold your numeric string.
>
> I've done something similar and wrote it up in the DDJ January 2000 issue.
> Drop by my website for the source code (for CodeWarrior). Look under
> EuroCalculator.
>
>
> --
> Michael Yam
> www.ytechnology.com
> [EMAIL PROTECTED]
>
>
> Tim Astle <[EMAIL PROTECTED]> wrote in message
> news:9437@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
> >
> >
> >
> >
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html