delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/02/08:03:48

From: michael DOT mauch AT gmx DOT de (Michael Mauch)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: converting floats to strings
Date: Tue, 02 Dec 1997 09:55:40 +0100
Organization: Gerhard-Mercator-Universitaet -GH- Duisburg
Lines: 19
Message-ID: <3488c879.7562143@news.uni-duisburg.de>
References: <199712020026 DOT NAA17553 AT fep1-orange DOT clear DOT net DOT nz>
NNTP-Posting-Host: ppp106.uni-duisburg.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Tue, 2 Dec 1997 12:09:36 GMT, "Jamie Love" <jamie DOT love AT clear DOT net DOT nz>
wrote:

> hi, my problem is summed up in the subject. Is there a function that can
> convert float variables to strings?

Yes, I usually use sprintf() to print to a character array, like this:

 float f;
 char buf[100];

 sprintf(buf,"%f",f);

Have a look at sprintf() in the libc info file.

You didn't mean C++ strings, did you?

Regards...
		Michael

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019