Well, first there's the correct codes for printf:
%d is short integer
%e and %g are for floats/doubles
But the second issue is whether or not Palm supports printing floating point numbers.
I've seen many, many messages in this newsgroup about functiosn that print floating
point values, so I would assume that PalmOS
doesn't directly support it. (Very little of the normal stdlib /stdio is supported
under the PalmOS.)
My advice is to search the archives of this forum for "print double" or "print float."
Definitely a lot about this in the last few
months.
Good luck!
- Jeff
Jari Kaipio wrote:
> HI,
>
> I'm new for Palm programming and i'm trying to build my first simple app, i
> need to print out the money value with WinDrawChars, now i cant get the
> right string out, i have tried %i , %d , %f and others but nothing works, i
> always get the wrong value, so what's wrong in this code?
>
> char chMsg[50];
> float Value, UserVal, Rate;
>
> if (eventP->data.ctlSelect.controlID == MainBtnCalculateButton)
> {
> UserVal = 1000;
> Rate = 0.595;
> Value = UserVal * Rate; //Value is OK in this point
> StrPrintF(chMsg, "Sum is: %i", Value);
> oldFont = FntSetFont(largeFont);
> oldUndeline = WinSetUnderlineMode(grayUnderline);
> WinDrawChars(chMsg, StrLen(chMsg), 6, 96);
>
> FntSetFont(oldFont);
> WinSetUnderlineMode(oldUndeline);
> handled = true;
> }
>
> I'm using CW 7.0 in Windows 2000 Pro SP1
>
> Jari Kaipio
> Finland
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see
>http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/