银河基金管理公司:htons()/ntohs()函数使用?具体请看代码
来源:百度文库 编辑:九乡新闻网 时间:2024/05/02 21:47:30
#include最佳答案#include union {short s;char c[sizeof(short)];}un,nn;int main(){un.s=0x0102;if(sizeof(short)==2){if(un.c[0]==1&&un.c[1]==2)printf("1big-endian\n");else if(un.c[0]==2&&un.c[1]==1)printf("1littel-endian\n");}else{printf("sizeof(short)=%d\n",sizeof(short));}nn.s=htons(un.s); 注意:用这句和下面注释掉的语句输出结果一样结果一样。为什么?//nn.s=ntohs(un.s);if(sizeof(short)==2){if(nn.c[0]==1&&nn.c[1]==2)printf("2big-endian\n");else if(nn.c[0]==2&&nn.c[1]==1)printf("2littel-endian\n");}else{printf("sizeof(short)=%d\n",sizeof(short));}return 0;}
htons()/ntohs()函数使用?具体请看代码
htons(), ntohl(), ntohs(),htons() 函数
htons(), htonl(), ntohs(), ntohl()
htons 与 ntohs 的区别
ntohs, ntohl, htons,htonl inet_aton等详解 - lvpw...
内经使用(具体方法)
CloseHandle()函数的使用
malloc函数怎么使用
SUM函数的使用
使用钩子函数[1]
使用钩子函数[2]
EXCEL使用 合并函数
excel中的rand函数的具体用法
具体使用香水(女)
ubuntu10.10使用具体设置
通配符函数 MatchesMask 的使用
WaitForSingleObject函数的使用1
QQ空间代码数字具体说明 -
怎么使用代码?
6.4.4 使用tcgetattr函数与tcsetattr函数控制终端
a【Word模板使用具体解析】a
htonl(),htons(),inet
四招成为Excel函数使用高手
如何在 Excel 中使用 LOOKUP 函数