【发布时间】:2019-11-08 12:40:31
【问题描述】:
我正在查看inet_ntop 文档。通常,C 中的字符串生成器操作会返回指向字符串结尾的指针,或者返回指示写入字符串长度的整数。
inet_ntop 的文档非常含糊:
On success, inet_ntop() returns a non-null pointer to dst. NULL is
returned if there was an error, with the errno set to indicate the
error.
这里有两个问题:
空字符串终止:不清楚是否需要在以 3 或更多顺序编译时打印
inet_ntop的内存分配中添加空字符串分隔符我不知道函数的输出是返回一个指向最后写入字符的指针,还是第一个写入字符的指针。
inet_ntop 返回什么?
【问题讨论】: