あえてC++の機能でおこなうと
c++
1#include <iostream>
2#include <string>
3#include <sstream>
4#include <ios>
5#include <iomanip>
6
7
8int main()
9{
10 unsigned char senId[] = {0x53, 0x41,0x4E, 0x00, 0x41, 0x53};
11 std::ostringstream oss;
12 oss << std::setfill('0') << std::uppercase;
13 for(unsigned int it : senId){
14 oss << std::setw(2) << it;
15 }
16 std::string str = oss.str();
17 std::cout << str << std::endl;
18}
ただし非常に煩雑ですので、C言語のsnprintfを用いて
c++
1#include <iostream>
2#include <string>
3#include <cstdio>
4
5int main(){
6 unsigned char senId[] = {0x53, 0x41,0x4E, 0x00, 0x41, 0x53};
7 std::string str(13, '\0');
8 std::snprintf(&str[0], str.size(),
9 "%02d%02d%02d%02d%02d%02d", senId[0], senId[1],
10 senId[2], senId[3],
11 senId[4], senId[5]);
12 std::cout << str << std::endl;
13}
のが楽かもしれません。