所有栏目

htonl()

作者:爱百科

将主机数转换成无符号长整型的网络字节顺序。本函数将一个32位数从主机字节顺序转换成网络字节顺序。

htonl()介绍

将主机数转换成无符号长整型的网络字节顺序。本函数将一个32位数从主机字节顺序转换成网络字节顺序。

htonl()简述

将主机数转换成无符号长整形的网络字节顺序。

#include

uint32_t htonl(uint32_t hostlong);

hostlong:主机字节顺序表达的32位数。

htonl()注释

本函数将一个32位数从主机字节顺序转换成网络字节顺序。

htonl()用法

htonl()返回值

htonl()返回一个网络字节顺序的值。

参见:

htons(),ntohl(),ntohs().

htonl()Linux

在Linux系统下:

#include

uint32_t htonl(uint32_t hostlong);

有些系统包含的头文件是 而不是 .

htonl()相关函数

uint16_t htons(uint16_t hostshort);

uint32_t ntohl(uint32_t netlong);

uint16_t ntohs(uint16_t netshort);

网际协议在处理这些多字节整数时,使用大端字节序。

在主机本身就使用大端字节序时,这些函数通常被定义为空宏。

htonl()MSDN原文

This function converts au_longfrom host to TCP/IP network byte order, which is big-endian.

u_long htonl(u_longhostlong);Parameters

hostlong

32-bit number in host byte order.

Return Values

This function returns the value in TCP/IP network byte order.

Remarks

This function takes a 32-bit number in host byte order and returns a 32-bit number in the network byte order used in TCP/IP networks.

htonl,其实是host to network, l 的意思是返回类型是long

热点导航
教育资讯 知道问答 公考资讯 司法考试 建筑知识 工作范文 大学排名 报考专业 学习方法 句子美文 秒知回答 作业解答 精选答案 知途问学