邪器 第二书包网:htonl

来源:百度文库 编辑:九乡新闻网 时间:2024/05/03 04:52:41
htonl()
简述:
将主机的无符号长整形数转换成网络字节顺序。
#include
u_long PASCAL FAR htonl( u_long hostlong);
hostlong:主机字节顺序表达的32位数。
注释:
本函数将一个32位数从主机字节顺序转换成网络字节顺序。
返回值:
htonl()返回一个网络字节顺序的值。
参见:
htons(), ntohl(), ntohs().
在Linux系统下:
#include
uint32_t htonl(uint32_t hostlong);
相关函数:
uint16_t htons(uint16_t hostshort);
uint32_t ntohl(uint32_t netlong);
uint16_t ntohs(uint16_t netshort);