record_data_num=((data_buffer[0]-0x30)*1000000
+(data_buffer[1]-0x30)*100000
+(data_buffer[2]-0x30)*10000
+(data_buffer[3]-0x30)*1000
+(data_buffer[4]-0x30)*100
+(data_buffer[5]-0x30)*10
+(data_buffer[6]-0x30)*1);
record_data_num 是unsigned long 类型
data_buffer是unsigned char 类型
data_buffer[0]='0';
data_buffer[1]='0';
data_buffer[2]='6';
data_buffer[3]='5';
data_buffer[4]='5';
data_buffer[5]='2';
data_buffer[6]='8';
即0x0000fff8
而运行结果, record_data_num 是4294967288 即0xfffffff8
这是为何? 麻烦指点,谢谢 |