其实我的本意是GPS数据吐出来的不都是ASCII吗,都当做字符串处理
我解析到变量char card_latitude[22]={0x0};
card_latitude 赋值 "3803.2312";
然后我有个数组char gps_info_buffer[70] = {0};
int currlen =0;
gps_info_buffer[currlenn++] = 0x7e;
gps_info_buffer[currlenn++] = 0x11;
gps_info_buffer[currlenn++] = 0x22;
int latitude = 0;
latitude = (int)(atof(card_latitude) *10e5);
dbg_print("latitude is %d\r\n",latitude);
sprintf((char *)(gps_info_buffer + currlen), "%x", latitude);
currlen += 4;
我个人认为gps_info _buffer 该是 7e 11 22 02 44 53 B8 (16进制)
可是结果不对?是 7e 11 22 30 00 00 00
我解析到变量char card_latitude[22]={0x0};
card_latitude 赋值 "3803.2312";
然后我有个数组char gps_info_buffer[70] = {0};
int currlen =0;
gps_info_buffer[currlenn++] = 0x7e;
gps_info_buffer[currlenn++] = 0x11;
gps_info_buffer[currlenn++] = 0x22;
int latitude = 0;
latitude = (int)(atof(card_latitude) *10e5);
dbg_print("latitude is %d\r\n",latitude);
sprintf((char *)(gps_info_buffer + currlen), "%x", latitude);
currlen += 4;
我个人认为gps_info _buffer 该是 7e 11 22 02 44 53 B8 (16进制)
可是结果不对?是 7e 11 22 30 00 00 00