2012年6月9日

确定系统中的字节序是大端字节序还是小端字节序。

摘要: 代码如下:#include<stdio.h>typedefunion{ unsignedshortintvalue; unsignedcharbyte[2];}to;intmain(intargc,char*argv){ to typeorder; typeorder.value=0xabcd; if(typeorder.byte[0]==0xcd&&typeorder.byte[1]==0xab) { printf("Low endian byte order!\n"); } if(typeorder.byte[0]==0xab&&am 阅读全文

posted @ 2012-06-09 20:24 罗烨鑫 阅读(237) 评论(0) 推荐(0) 编辑

导航