   FAST way to convert any number to a *char type string
  whats the FASTEST way to convert all numbers (int, float, double, ect) to a *char string? i know similar topics have been addressed but im really curious as to the fastest (as in most efficient in all regards) way of doing it (well in all regards except the actual length of the code, im more concerned about memory usage and processing time    Bungo!  
  For runtime libraries that support it, ftoa and itoa, probably. If they don''t, consider writing your own, or checking out newlib (do a websearch).    How appropriate. You fight like a cow.  ;  Usign C or C++?With C++ it''s possible to create _template_ classes.You might be able to write a little converter based on templates.---------------------Google is a verb! ;  sprintf for all the types you want.  ;  Standard C libraries... Forgot about them ;  I dunno about ftoa, but atof is insanely slow... totaly ruined my model loader...    -~-The Cow of Darkness-~-  ;  char*va(char *format, ...){va_listargptr;static charstring[1024];va_start (argptr, format);vsprintf (string, format,argptr);va_end (argptr);return string;}  used as:char b = va("%i is int, %f is float",7,10.1);~Main    ==Colt "MainRoach" McAnlisProgrammerwww.badheat.com/sinewave  ;quote:Original post by duhroach   char*va(char *format, ...){va_listargptr;static charstring[1024]; va_start (argptr, format);vsprintf (string, format,argptr);va_end (argptr);return string;}    [/source]used as:char b = va("%i is int, %f is float",7,10.1);~Main    ==Colt "MainRoach" McAnlisProgrammerwww.badheat.com/sinewave  That's just full of problems waiting to creep up .  Like, what if he needs to return multiple strings, it'd over-write the current string, since it's a static variable.  Also, setting a char b = char* won't work, but that was just a typo I presume.If you're just trying to convert a single variables, I'd just use sprintf.inline void DoInt(char *str, int &t){ sprintf(str,"%d",t);}inline void DoFloat(char *str, float &t){ sprintf(str,"%f",t);}int test=10;char MyTestString[256];DoInt(MyTestString,test);I don't know about quickest, but it's pretty simple, and pretty fast.  I'm sure itoa, and ftoa will be faster though, since this processes the string and arguments passes, while itoa just processes the integer, and ftoa just processes the float, not reads a string .--- Edit ---Stupid thing put the quote tags in the wrong place .[edited by - Ready4Dis on March 31, 2003 12:27:30 AM];  hmmm i was definatly thinking of using templates, cause i would really like to have one function that works for int, float, double, DWORD, __int64, ect.two questions what exactly does sprintf do? and what does inline mean? ive seen it before, dunno what it does lol. if sprintf was made for consol programs like printf is then it wont do =/ i need to RETURN the *char cause i need to use it for something else (something that isnt a consol program at all lol)    Bungo!  ;  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-~-  