is your friend.
Because I have a feeling about what you're going to ask next, I'll mention that
is also your friend. Sprintf() returns the formatted string. Printf(), on the other hand, prints it to the currently selected filehandle (STDOUT by default).
. The two functions are alternatives, not to be used at the same time. *sigh*