Ya, I didn't want the extra '*', that was just a typo. Thanks for the info on the sprintf, is there any plan for float support? Seems silly there is support for float as a general use data type, but not in sprintf.
BTW, I forgot to tell you earlier, typecasting gets rid of the warning, but not the error. If I type case to double, I just get "(NULL)" in the resulting string. Thanks -Mark -----Original Message----- From: mspgcc-users-ad...@lists.sourceforge.net [mailto:mspgcc-users-ad...@lists.sourceforge.net] On Behalf Of Chris Liechti Sent: Friday, August 26, 2005 9:11 PM To: mspgcc-users@lists.sourceforge.net Subject: Re: [Mspgcc-users] Sprintf warning/error Stokes, Mark wrote: > When using sprintf with float variables, I get the following warning (and the > output > string gives a "(NULL)" in the place of the variable). > > warning: passing arg 1 of `sprintf' from incompatible pointer type see below > warning: double format, float arg (arg 3) > warning: double format, float arg (arg 3) %f wants a float, not a double, you have to typecast the value or use %g the main problem is that our printf doesn't yet support floats/doubles... > Example code: > void showfloat( ) > { > float tempfloat; > char *buf[20]; thats certainly not what you want. you declare a pointer to an array while you want an array... char buf[20]; > tempfloat = 9.40; > sprintf( buf, "%.0f", tempfloat ); > usart1Puts( buf ); > } chris ------------------------------------------------------- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users