At 13:56 30/01/2001 -0500, you wrote:
>Hi,
>
>I've found some very strange behavior in my code, and I've distilled the
>problem down into these few lines of code:
>
> char s[10];
> double d;
>
> s[0] = '4';
> d = (double) (s[0] - '0');
> HostTraceOutputTL(appErrorClass, "Number is %ld", (Int32) d);
>
> StrCopy(s, "4");
> d = (double) (s[0] - '0');
> HostTraceOutputTL(appErrorClass, "Number is %ld", (Int32) d);
>
>The output from these statements is:
>
> Number is 4
> Number is 0
>
>How can the results be different? I've tried every kind of cast and
>intermediate variable I could think of. Whether s is char or unsigned char
>makes no difference either.
You cannot simply typecast between two incompatible types!!! Have you heard
of stol() or stod() or whatevet they're called... Can't remeber now, my
mind is on /^perl$/o at the moment...
Igor M-)
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/