i never understood sprintf.. can someone link me some info on it?
In general:
sprintf( (char*)destination, text string, variable, variable, variable, ... )
char buffer[100]
int nbr_of_apples = 17
float gallons_of_water 2.487
char name[] = "John Doe"
sprintf( buffer, "I have %u applies", nbr_of_apples")
buffer = I have 17 apples
sprintf( buffer, "I have %u apples floating in %f gallons of water", nbr_of_apples, gallons_of_water)
buffer = I have 17 apples floating in 2.48700000 gallons of water (not sure how many 0's would actually be there)
sprintf( buffer, "My name is %s.", name )
buffer = My name is John Doe.
Hopefully that makes sense, you have a destination buffer, a format string, and variables. For every %, you need a u (unsigned intiger) d (signed integer) f (float) x (ascii representation of a unsigned int lowercase) or X (ascii representation of an unsigned int uppercase) s (string). If you want a % printed to the buffer, use %%
I usually go to Wikipedia and search for string.h to get this info if I forget anything. Once you use it, it becomes REALLY simple to format numbers into strings. However, it is fairly slow to execute (I think) and is a pretty large memory hog.