Jan Bandouch wrote:
So another question for the experts:
I've found out why sprintf() shows weird behaviour, and that is a
"#define sprintf StrPrintF" in /Core/System/Unix/unix_stdio.h. So I never actually call the "real" sprintf().

I've found out that my previous post is false. I have not included any header with a "#define sprintf StrPrintF", the mentioned header only exists for people who want to continue using Unix calls.


But now I'm wondering even more why "sprintf(str, "%f", <some double>);" writes "%f" to the string and not the double.

Probably has to do with StrPrintF() not supporting the %f format. Even if it doesn't look like you're including the header, it's probably getting set anyway somehow and you're still just calling StrPrintF().


I couldn't speculate on why that function call doesn't support the float format. You're best option (other than writing your own sprintf) is to use the code previously posted or some other that you find for formatting floats.

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

Reply via email to