On Fri, 2003-01-24 at 05:15, Niilo Minkkinen wrote:
> I want to format sprintf() -like output using standard C -methods (
> "%.2f" ),
> how that can be done ?
> Seems the sprintf() ( = StrVPrintF ) do not support it.
> 

Well, this is kind of ugly, but it works for me:

======================================8<---------------------------
UInt8  a,b;
float  f;
char   *strng;

a = (UInt8)f;
b = (UInt8)((f - a) * 100);
StrPrintF( strng, "%d.%d", a, b );
======================================8<---------------------------

Now the fun part is in trying to implement a "scanf" input to read a
string from a field into a float.  That one is even uglier.

        /dwight
-- 
Dwight N. Tovey
Email: [EMAIL PROTECTED]
http://www.dtovey.net/dwight
---
A programmer is someone who solves a problem you didn't know you had in a way you 
don't understand.


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to