更新时间:2021-12-06 06:26:07
正如您提到的c ++一样,这是一个答案. Iomanip用于将十六进制形式的整数存储到stringstream中.
As you have mentioned c++, here is an answer. Iomanip is used to store ints in hex form into stringstream.
#include <sstream>
#include <iomanip>
std::string hexStr(BYTE *data, int len)
{
std::stringstream ss;
ss << std::hex;
for( int i(0) ; i < len; ++i )
ss << std::setw(2) << std::setfill('0') << (int)data[i];
return ss.str();
}