[En-Nut-Discussion] print decimal number

Michael Baverso mbaverso at elcontech.com
Sat Dec 14 07:58:28 CET 2002


Sangman,

Try the dtostrf function defined in stdlib.h, you must add the -lm switch as
follows:
LIBS =

$(LIBDIR)/init.o -lnutnet -lnutpro -lnutfs -lnutos -lnutdev -lnutos -lm<----
---

This function converts floats to a string...worked for me .
*---------------------------------------------------------------------------
--
* char *dtostrf(double num, char width, char precision, char *str)
* Converts a double (float) to a string in the printf f format.
* This is a substitute for printf("%width.precisionf", num,)
* Width is the minimum width of the output string including '.' and possible
sign.
* Precision is the number of digits required after the decimal point.
* If precision is < 0, the string is left adjusted with leading spaces.
* If precision is > 0, the string is right adjusted with trailing spaces.
* The number will be rounded based on precision.
*---------------------------------------------------------------------------
-------*/

Regards,

----- Original Message -----
From: "Sangman Cho" <csmcho2002 at yahoo.co.kr>
To: <en-nut-discussion at egnite.de>
Sent: Friday, December 13, 2002 10:27 AM
Subject: [En-Nut-Discussion] print decimal number


> Mr Kipp
> I would like to print  decimal number beside integer
> in httpd.c.
> What function I can use in httpd.c beside
> 'NutPrintInteger'?
> I can't find appropriate function in ethernut.
>
> Kind regards,
> Mr. Cho
>
> _____________________________________________________________________
> 디지탈 카메라와 찰떡 궁합- 야후! 사진
> http://kr.photos.yahoo.com/
> 친구들과 함께 바꿔보세요. - 야후! 메신저
> http://kr.messenger.yahoo.com/
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo/en-nut-discussion
>




More information about the En-Nut-Discussion mailing list