- 论坛徽章:
- 0
|
在AIX64位机上,htonl、ntohl和htons、ntohs似乎没起作用。
$uname -a
AIX su_p57_dev 3 5 00C2BF1B4C00
请高手指点一下,谢谢。
比如下面这段程序,在AIX64(使用了-q64)和SCO上分别编译。
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
void main()
{
short len=738;
printf("sizeof short= %d\n",sizeof(short));
printf("sizeof int = %d\n",sizeof(int));
printf("sizeof long = %d\n",sizeof(long));
printf("htons( %d )=%d\n",len,htons(len));
printf("ntohs( 57858 )=%d\n",ntohs( 57858 ));
}
在AIX64上的执行结果如下:
sizeof short= 2
sizeof int = 4
sizeof long = 8
htons( 738 )=738
ntohs( 57858 )=57858
在SCO上的执行结果如下:
sizeof short=2
sizeof int =4
sizeof long =4
htons( 738 )=57858
ntohs( 57858 )=738
[ 本帖最后由 BlackSnail 于 2006-10-11 14:08 编辑 ] |
|