UNIX环境编程学习笔记------编程实例-----对于 函数 inet_ntop()函数的第四个参数的理解
2015-11-27 13:39
531 查看
对于 函数 inet_ntop()函数的第四个参数的理解
1.函数原型:
#include <arpa/inet.h>
const char *inet_ntop(int af, const void *src,char *dst, socklen_t size);
DESCRIPTION
This function converts the network address structure src in the af address
family into a character string. The resulting string is copied to the buffer
pointed to by dst, which must be a non-NULL pointer. The caller specifies the
number of bytes available in this buffer in the argument size.
翻译:
这个函数把 src结构体的网络地址转换成一个字符串,产生的这个字符串被复制到dst所指向的缓冲区中,
调用者必须以参数大小的方式指明缓冲区的可用字节数。
1.convert convert
英 [kən'vɜːt] 美 [kən'vɝt]
vt. 使转变;转换…;使…改变信仰
convert sth into sth
2.resulting
英 [rɪ'zʌltɪŋ] 美 [rɪ'zʌlt]
adj. 作为结果的
v. 致使(result的ing形式);产生
3.
. caller
英 ['kɔːlə] 美 ['kɔlɚ]
n. 访客;[通信] 呼叫者;打电话者;召集员
adj. 新鲜的
. specify
英 ['spesɪfaɪ] 美 ['spɛsɪfaɪ]
vt. 指定;详细说明;列举;把…列入说明书
e. Each recipe specifies the size of egg to be used.
每种食谱都具体说明了所用鸡蛋的大小。
//
我所不理解的是:这个size到底是谁的size???
解答:
size的值就是: sizeof(*dst)
即: 用于存储字符串的缓冲区的大小。
1.函数原型:
#include <arpa/inet.h>
const char *inet_ntop(int af, const void *src,char *dst, socklen_t size);
DESCRIPTION
This function converts the network address structure src in the af address
family into a character string. The resulting string is copied to the buffer
pointed to by dst, which must be a non-NULL pointer. The caller specifies the
number of bytes available in this buffer in the argument size.
翻译:
这个函数把 src结构体的网络地址转换成一个字符串,产生的这个字符串被复制到dst所指向的缓冲区中,
调用者必须以参数大小的方式指明缓冲区的可用字节数。
1.convert convert
英 [kən'vɜːt] 美 [kən'vɝt]
vt. 使转变;转换…;使…改变信仰
convert sth into sth
2.resulting
英 [rɪ'zʌltɪŋ] 美 [rɪ'zʌlt]
adj. 作为结果的
v. 致使(result的ing形式);产生
3.
. caller
英 ['kɔːlə] 美 ['kɔlɚ]
n. 访客;[通信] 呼叫者;打电话者;召集员
adj. 新鲜的
. specify
英 ['spesɪfaɪ] 美 ['spɛsɪfaɪ]
vt. 指定;详细说明;列举;把…列入说明书
e. Each recipe specifies the size of egg to be used.
每种食谱都具体说明了所用鸡蛋的大小。
//
我所不理解的是:这个size到底是谁的size???
解答:
size的值就是: sizeof(*dst)
即: 用于存储字符串的缓冲区的大小。
相关文章推荐
- C++设计模式[二十一]访问者模式
- java生成二维码
- 话题13 --鞭辟入里 条件表达式的类型深入
- C++ UFunction({FLAG}) 宏 FLAG 解释笔记
- java设计模式之策略模式
- UE4 C++ 使用FTimeLine/FTime 实例 Actor moving faster than Timeline
- jRadioButton
- springmvc通过@Value注解读取Properties配置文件的值,junit测试可以取到值,但是在业务中无法读取
- Java通过浏览器请求头(User-Agent)获取 浏览器类型,操作系统类型,手机机型
- Mac自带ftp工具链接共享服务器
- spring
- 单片机:c语言实现秒表计数(按键开始,结束,重置)
- Asp.Net 5 Web Hook
- C# Attribute(中)——Attribute本质论
- ASP.NET 上的 Async/Await 简介
- c语言打印空心菱形
- C#操作word文档
- Maven构建一个多模块的Spring Boot + Spring MVC项目,完全基于java config
- C++在类模板中实现友元函数的方法
- c++ 孟岩推荐 书籍