Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!cs.utexas.edu!rutgers!columbia!cubmol!ping From: ping@cubmol.BIO.COLUMBIA.EDU (Shiping Zhang) Newsgroups: comp.lang.c Subject: Re: converting a float to a character string Message-ID: <317@cubmol.BIO.COLUMBIA.EDU> Date: 13 Aug 89 15:33:08 GMT References: <10720@boulder.Colorado.EDU> Reply-To: ping@cubmol.UUCP (Shiping Zhang) Organization: Dept. of Biology, Columbia Univ., New York, NY Lines: 20 In article <10720@boulder.Colorado.EDU> hartkopf@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@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