1 #include "stdio.h"
2 #include "stdlib.h"
3 #include "string.h"
4
5 unsigned char ArrayCom[16] = {
6 11, 12, 13, 14, 15, 16, 17, 18,
7 19, 20, 21, 22, 23, 24, 25, 26};
8 unsigned char ArrayHex[16] = {
9 0x2c, 0x57, 0x8f, 0x79, 0x27, 0xa9, 0x49, 0xd3,
10 0xb5, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
11
12 char *strHex = "01aa0304050607083f0add0c0d0e0f00";
13 char *strCom = "1D1213AB6FC1718B19202122232425A6";
14
15 int main(int argc, const char *argv)
16 {
17 int cnt;
18 char str[33] = {0};
19 unsigned char out[33];
20 arrayToStr(ArrayCom, 16, str);
21
22 int outlen = 0;
23 StringToHex(strCom, out, &outlen);
24 for(cnt = 0; cnt < outlen; cnt ++)
25 {
26 printf("%02X ", out[cnt]);
27 }
28 putchar(10);
29
30 return 0;
31 }