是否有一种方法可以转换Hexdump eg AEC4D2F3C6A4E70EA6CEA074F65812D2A34B180CC92B817EDCD867167E7A91C5BEB942F0将其列入Chexecimal chare chare of CharexadeCimal chare?如果是这样,什么?

有帮助吗?

解决方案

从stdin读取并打印到stdout:

int main() 
{
    int ch;
    while(scanf("%2x", &ch) == 1)
        putchar(ch);
}

我认为您可以根据自己的特定来源和目的地要求轻松修改它。

其他提示

其中之一:

size_t unBytes = strHex.size() / 2;
std::string strResult(unBytes, 0);
for (size_t i = 0; i < unBytes; ++i)
{
    std::istringstream in(strHex.substr(2*i, 2));
    int byte = 0;
    in >> std::hex >> byte;
    strResult[i] = byte;
}

使用scanf %hhx 反复。看 man scanf.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top