In C++ you would use std::string and stringstreams.
In C you would use char* and sprintf. sprintf is pretty similar to printf except it prints to an area in memory and not the screen. If that sprintf were a printf, do you think it would print on the screen what you want?
Get Microsoft Visual C++ Express here or CodeBlocks here.
Get STLFilt here to radically improve error messages when using the STL.
Get these two can't live without C++ libraries, BOOST here and Loki here.
Check your code with the Comeau Compiler and FlexeLint for standards compliance and some subtle errors.
Always use [code] code tags [/code] to make code legible and preserve indentation.
Do not ask for help writing destructive software such as viruses, gamehacks, keyloggers and the suchlike.