Hi Alexandre, Please look in the manual under "Library Routines". It explains why floating point support is disabled in printf by default and how to turn it on.
Greets, Maarten > Hello everyone. > > I had a problem working with float and integer numbers in SDCC using the > sprintf function. > > Here the important parts of code: > > char buff[]; // global variable > > ... > > void main(void) > } > > > .... > > > sprintf(buff,"KEY released. %f %d %c %s \r\n",18.25, 125, 'C', > "bla"); > USARTsendString(buff); > > ... > } // end main function > > in sprintf function I try to print many data types to a string and send it > through serial port to a PC. > the result is: > KEY released. <NO FLOAT> ? C bla. > > I tried also this way: > > void main (void) > { > ... > float fl1 = 18.725; > int INT = 18725; > char str[10] = "bla"; > char ch = 'C'; > > ... > > sprintf(buff,"KEY released. %f %d %c %s \r\n",fl1, INT, ch, str); > > ... > } > > same result: KEY released. <NO FLOAT> ? C bla. > > I included stdio.h and stdlib.h header files. > > There is a specific way to pass the arguments to this function? Anyone had > the same problem? Is there a way to solve this. > > Thanks in advance for your help. > > Best regards > Alexandre Martins > > --------------------------------------------------- > > Nao perca as melhores sugestoes para o Dia dos Namorados! > Saiba tudo em http://cupido.aeiou.pt/ > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with > Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code > to > build responsive, highly engaging applications that combine the power of > local > resources and data with the reach of the web. Download the Adobe AIR SDK > and > Ajax docs to start building applications > today-http://p.sf.net/sfu/adobe-com > _______________________________________________ > Sdcc-user mailing list > Sdcc-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sdcc-user > > ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user