converting a float to a character string

Shiping Zhang ping at cubmol.BIO.COLUMBIA.EDU
Mon Aug 14 01:33:08 AEST 1989


In article <10720 at boulder.Colorado.EDU> hartkopf at tramp.Colorado.EDU (Jeff Hartkopf) writes:
>Does anyone have a function or know where I could get one that will convert
>a double (or at least a float) to a character string?  It looks like a hard


>Jeff Hartkopf

>Internet:
>hartkopf at tramp.Colorado.EDU


I think you can use sprintf() to achieve the task.
Of course, the formate argument of this function should be different
for varibles with differrent size of values according to your requests.
So you would have to take conditional test on the values of the varibles
before you call sprintf() with desired formate.



-ping



More information about the Comp.lang.c mailing list