There are standard functions like atof(), itoa()......
my question is: Is there a function to convert float to string...??
I searched the MSDN library, but cannot find "ftoa()"....does it have other names..??
_____
There are standard functions like atof(), itoa()......
my question is: Is there a function to convert float to string...??
I searched the MSDN library, but cannot find "ftoa()"....does it have other names..??
_____
sprintf(string, "%f", floatnum);
If you understand what you're doing, you're not learning anything.
Which is it? float to int or float to string? First one, second one... both?Originally Posted by AssistMe
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
The answer to your questions is no and yes respectively. There isn't a function to convert a float to int, but you don't need one.Code:char buf[ BUFSIZ ] = {0}; int x = 0; float f = 0.0; f = 123.45; x = f; /* float to int */ sprintf( buf, "%f", f ); /* float to string */
Quzah.
Hope is the first step on the road to disappointment.
Opppss.......my mistake...
I mean float to string
_____