Cstr

Hi

I’m trying to convert a float to a string using the Cstr method, as I’ve done millions of times. But suddenly I get a function not defined error :frowning: . Do I need to include something or what?

You can use Form to convert a float to a string:

Float_t f = 12345.;
printf("%s\n", Form("%g",f) );

Thanks, that did the trick. I’m still a little perplexed that Cstr didn’t work. Cint doesn’t worke either :neutral_face:

EDIT: typo corrected

Ok I just remebered the Cint and Cstr is something I picked using Visual Basic #-o . That quite imbarresing. So when I said I used them a million times… well I kinda did :^o

Yes I was a bit suprised when I googled CStr and found out it is some Windows stuff.
I wondered how you could have used it in ROOT… That’s why I proposed you the way I would
do it with the standard ROOT tools.