In reply to "Tim Astle" <[EMAIL PROTECTED]>:

The return type of your GetDecFromString is decNum *. Although you 
don't show us the source to GetDecFromString, I'll bet it has an 
automatic (stack) variable of type decNum, and returns the address of 
it. This is, in general, a Bad Thing (tm).

Again, you didn't show us, so I'm just speculating. If, however, this 
is the case, here is how you fix it:

Change GetDecFromString to this:
        void GetDecFromString(CharPtr string, decNumPtr result);

Make other changes as shown below:

> // This is my decimal structure
> typedef struct
> {
>      UInt num;
>      UInt dec;
> } decNum, *decNumPtr;
> 
> 
> 
> CharPtr AddDecimals(CharPtr str1, CharPtr str2, UInt places)
> {
>      // Need to integrate limited decimal places in string
>      // Rounding as well...
> 
>      decNumPtr dec1, dec2;
this should be:
       decNum dec1, dec2;
>      UInt d, result, length;
>      int x = 0, i = 0, j = 0;
>      CharPtr lstr, strResult;
> 
>      // Get Decimal structure from Strings
>      dec1 = GetDecFromString(str1);
>      dec2 = GetDecFromString(str2);
these two change to:
       GetDecFromString(str1, &dec1);
       GetDecFromString(str2, &dec2);
       // from here on out, dec-> becomes dec. (you get the idea)
> 
>      // Find difference of decimals
>      d = dec1->dec - dec2->dec;
       d = dec1.dec - dec2.dec;

[ the rest deleted ]

--
Roger Chaplin
<[EMAIL PROTECTED]>

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

Reply via email to