I think section of the SDCC manual is relevant to you.  It takes about the need to recompile one of the library modules (printf_large.c) with -DUSE_FLOATS=1 to enable float support in printf() related functions (which includes sprintf()).

If that's not the problem you might like to post a complete example with the command line arguments that are being used with SDCC.  You might also need to explain how you know that "oo" shows the string ,No Float (as there is no output in your example).

I also notice your example has some typing errors and will not compile as it stands. It is usually best to use cut-and-paste rather than re-type examples manually as this helps avoid this type of error.

I hope this helps you.


On 5 Dec 2008, at 06:32, zhinan,Lee(htz) wrote:

I am now developing a MCS51 controller by the development tool IDE http://www.opcube.com/home.html#MIDE51.
I have a problem about a data calculation that is a conversion from a string to float using the function "sprintf()" and "atof()"
Here is a sample code
#include "stdlib.h"
#include "stdio.h"
void main()
    unisgned char *ss="12345.67";
    float ff;
    unisigned char oo[100];
    sprintf(oo," oo=%f",ff);
However, the output of the "oo" will be shown the string <No Float>.
Can you help me the situation? I don't know what to do now...
Thank you so much
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
sdcc-devel mailing list