C 字串轉16進字串 + 0x ,
void printfHex(unsigned char *str)
{
int i,j;
int len = strlen(str);
for( i=0,j=0; i<len/2; i++, j+=2)
{
printf("0x");
printf("%c%c",str[j],str[j+1]);
if(j!=len-2) printf(", ");
}
printf("\n");
}
int main()
{
unsigned char msg[]="1778380003A600068F0000003A";
unsigned char input[100];
//scanf("%s",input);
printfHex(msg);
return;
}