#include <iostream>
#include <sstream>
using namespace std;
void printStringInHex(const string &str)
{
ostringstream oss;
string temp;
for(int i=0; i<str.length(); i++)
{
char buff[2] = {0};
sprintf(buff, "%x02", (unsigned char)str.at(i));
//
oss << string(buff, sizeof(buff)) << " ";
}
cout << oss.str() << endl;
}
使用c++标准库将数据中的数据按十六进制打印输出
于 2024-04-21 14:01:07 首次发布