From: MCheu Newsgroups: comp.os.msdos.djgpp Subject: Re: float version of itoa Organization: Metronome Message-ID: References: <18555N369 AT web2news DOT com> X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 34 Date: Mon, 10 Mar 2003 19:56:21 -0500 NNTP-Posting-Host: 209.188.65.172 X-Trace: localhost 1047344239 209.188.65.172 (Mon, 10 Mar 2003 17:57:19 MST) NNTP-Posting-Date: Mon, 10 Mar 2003 17:57:19 MST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Mon, 10 Mar 2003 03:12:49 +0100, "Joel_S" wrote: >I don't think there's a built in version of a float to string conversion >routine, but does anybody have any code, or know a library that contains >such a routine? Thanks. If you were going the other way, it might be more of a challenge, but sprintf will probably do what you're asking. The following code is not guaranteed to run or even compile, but you get the idea. #include #include int main (void) { /* declare my vars */ float myFloat = 1.23456f; char myString[1000]; /* do conversion */ sprintf (myString, "%f",myFloat); /* dump output */ puts (myString); return 0; } ----------- Thanks MCheu