are you using C or C++??

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...