FAST way to convert any number to a *char type string

Started by
12 comments, last by BungoMan85 21 years ago
quote:Original post by cowsarenotevil
Sprintf is like the C i/o functions. You can use it wherever, even though I think it was made for dos. The MSDN has some stuff about it... I can't really explain it.

-~-The Cow of Darkness-~-


Actually, it was originally written for UNIX. As was almost everything related to C in the 1970's

Yes you can use it anywhere, as all compilers worth anything will have implementations of the standard C library.

[edited by - foofightr on April 1, 2003 12:15:46 AM]
Advertisement
With my loader calling getline and then using atof was about 10x slower than simply usin ifstream >> iVariable... strange.

-~-The Cow of Darkness-~-
-~-The Cow of Darkness-~-
I like boost::format.

But you''re asking about speed. I have no idea how fast it is. Converting numbers to strings isn''t really high on my list of time critical things to optimize. (things like rendering usually require more thought)

I''m hip because I say "M$" instead of "MS".
"There is only one everything"
itoa, atoi, ftoa, atof, and numerous other functions are probably faster than sprintf, because they are more specific to your needed conversion. Not that either is slow enough to really bother optimizing...

-Vulcan

This topic is closed to new replies.

Advertisement