64,654
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
void main(){
unsigned char In[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
char dst[256];
for(int i=0;i<sizeof(In);i++){
sprintf(dst+i*2,"%02x",In[i]);
}
dst[i*2]=0;
puts(dst);
}
#include <stdio.h>
int main(int argc, char* argv[])
{
char* tb="0123456789abcdef";
unsigned char In[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff};
char dst[256];
for(int i=0;i<sizeof(In);i++){
dst[2*i]= tb[(In[i]&0xf0>>4)&0x0f];
dst[2*i+1]=tb[In[i]&0xf];
}
dst[2*i]=0;
puts(dst);
return 0;
}