Re: int to string?

Fons Rademakers (rdm@pcsalo.cern.ch)
Mon, 18 May 1998 02:13:46 +0200 (METDST)


Hi Andy,

just use sprintf(), e.g.:

char s[32];
sprintf(s, "%d", 99);

Cheers, Fons.

>
> Could someone tell me how to turn an integer or float into a string? I
> want to put the values of Float_t variables into a TPave with the
> SetLabel() command, but the function only takes strings! C++ has a nice
> function called itoa(), which does exactly what I want, but it doesn't
> work from CINT (although atoi() does for some reason). Thanks in
> advance, Andy.
>

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910