Sprintf is your friend.
-fp
Update: Because I have a feeling about what you're going to ask next, I'll mention that
printf is also your friend. Sprintf() returns the formatted string. Printf(), on the other hand, prints it to the currently selected filehandle (STDOUT by default).
Update to my Update: Clarified any confusion regarding the use of sprintf and printf for
BazB and
Sara. The two functions are alternatives, not to be used at the same time. *sigh*