c - strlcpy 中的 'l' 是什么?

标签 c bsd c-strings

strlcpy 中的“l”代表什么?我敢肯定,在询问之后这将是非常明显的,但我似乎无法在任何地方挖掘出可靠的答案。

最佳答案

strlcpy 由 Todd C. Miller 和 Theo de Raadt(OpenBSD 项目)在 USENIX 1999 上介绍。

来自论文集,strlcpy and strlcat — Consistent, Safe, String Copy and Concatenation ,在摘要中写道:

The proposed replacement functions, strlcpy() and strlcat(), address these problems by presenting an API designed for safe string copies (see Figure 1 for function prototypes). Both functions guarantee NUL-termination, take as a length parameter the size of the string in bytes, and provide an easy way to detect truncation

因此很明显,l 代表长度

关于c - strlcpy 中的 'l' 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28332854/

相关文章:

通过 wlan 的 TCP 套接字

c - 从 C 中的 *char[] 变量获取第一个字符

c - 套接字编程指针错误

c - 将数组中的数字转换为整数。 (和更多)

c - 假设 char *p = "hello world",那么在 '\0' 之后是否存在任何 'd' ?

bash - 管道搜索模式到 BSD grep

c - 如何在c中将函数输入到文件中

sockets - BSD 套接字的文件描述符错误

c++ - 转换(const char*)var出错

c - strcpy 将随机数添加到空字符串