A C++ answer, safer on output size potential problem:
#include <sstream>
#include <iterator>
std::string DumpBytes(unsigned char* inputBytes, int inputBytesLength)
{
std::ostringstream oss;
std::copy_n(inputBytes, inputBytesLength, std::ostream_iterator<int>(oss, " "));
return oss.str();
}
cheers,
AR