delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/18/17:24:14

Message-ID: <37E3F6A0.B80A0505@armenia.multi.net.co>
Date: Sat, 18 Sep 1999 15:31:28 -0500
From: Jorge Ivan Meza Martinez <jimezam AT rayo DOT pereira DOT multi DOT net DOT co>
X-Mailer: Mozilla 4.6 [en] (Win98; I)
X-Accept-Language: es-CO,en
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Numbers to Strings
References: <7s0kea$qr6$1 AT rohrpostix DOT uta4you DOT at>
Reply-To: djgpp AT delorie DOT com

Hello,

> Hi, I'm quite new to programming in C++ and I have got a question about
> strings: How can I convert a number into a string,

you can use itoa/ftoa to convert from Integer to Ascii.

but it is easier using sprintf.

sprintf ( the_string, "%i", the_integer );

bye,

-- 

Jorge Iván Meza Martínez
nuevearanitas AT hotpop DOT com


Roland Moritz wrote:
> 
 e.g. there is a variable
> 
> int i;
> 
> then how do I make a string which contains the number-variable i in
> ASCII-code, so that I can use it, for instance, to give it out with the
> Allegro textout-function (Or is there another way to do this)? (Hope you
> know what I mean...something like the "str"-Function in Pascal, if this
> helps anyone...)

- Raw text -


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