Why can't ints and chars just get along?
Greetings;
Here is my question : how, in c++ does one convert an int,float,double or long to a char*,char[], or a string ?
(Being a java coder, i am used to all those lovely conversions, but I can''t seem to find them in c++)
As always, any help would be greatly appreciated.
Thanks, JP.
==============================================
I feel like a kid in some kind of store...
==============================================
www.thejpsystem.com
==============================================I feel like a kid in some kind of store... ============================================== www.thejpsystem.com
sprintf would be one way. The conversion routines such as itoa would be another.
Keys to success: Ability, ambition and opportunity.
Thanks, JP.
==============================================
I feel like a kid in some kind of store...
==============================================
www.thejpsystem.com
==============================================
I feel like a kid in some kind of store...
==============================================
www.thejpsystem.com
==============================================I feel like a kid in some kind of store... ============================================== www.thejpsystem.com
There''s also itoa(), but it seems to be more of a pain in the ass than sprintf.
To convert from character array to number, atoi or atof would be your choice.
To convert from character array to number, atoi or atof would be your choice.
or sscanf()..
I used to use itoa, but I wasn''t able to find an ftoa so I jumped to sprintf(), fprintf(), sscanf() and fscanf(). they''re fare more easier to handle. but if you want convertions to other than base 10 look at itoa...
cya,
Phil
Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
RAW!
I used to use itoa, but I wasn''t able to find an ftoa so I jumped to sprintf(), fprintf(), sscanf() and fscanf(). they''re fare more easier to handle. but if you want convertions to other than base 10 look at itoa...
cya,
Phil
Visit Rarebyte!
and no!, there are NO kangaroos in Austria (I got this questions a few times over in the states
RAW!
Visit Rarebyte! and no!, there are NO kangaroos in Austria (I got this question a few times over in the states ;) )
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement