老鸟帮看看字节颠倒实现little-endian的问题。
CString Cxxx::StrOfDWord(DWORD dwAddress){
unsigned char waddress[4]={0};
waddress[3]=(char)(dwAddress>>24)&0xFF;
waddress[2]=(char)(dwAddress>>16)&0xFF;
waddress[1]=(char)(dwAddress>>8 )&0xFF;
waddress[0]=(char)(dwAddress )&0xFF;
return waddress;
}
为什么最后还要一个&0xff呢?
我觉得waddress[3]=(char)(dwAddress>>24)就能实现。。