msdn学习笔记(三):htons;size_is;

本文详细介绍了Windows网络编程中的htons函数,用于将16位数值从主机字节顺序转换为网络字节顺序。此外,还讲解了[size_is]属性在动态分配内存和指针数组大小指定中的应用,强调了其与[max_is]属性的区别和配合使用场景。
摘要由CSDN通过智能技术生成

1.htons

The htons function converts a u_short from host to TCP/IP network byte order (which is big-endian).

u_short htons(
  u_short hostshort
);
Parameters
hostshort
[in] 16-bit number in host byte order.
Return Values
The htons function returns the value in TCP/IP network byte order.
Remarks

The htons function takes a 16-bit number in host byte order and returns a 16-bit number in network byte order used in TCP/IP networks.

Requirements

Client: Requires Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server.
Header: Declared in Winsock2.h.
Library: Use Ws2_32.lib.

2.size_is

Use the [size_is] attribute to specify the size of memory allocated for sized pointers, sized pointers to sized pointers, and single- or multidimensional arrays.

[ size_is(limited-expression-list) ]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值