• The function strncpy (3) can also be used to copy only a part of the source string into the destination.

    函数strncpy(3)还可以用来仅把源字符串的一部分复制到目标中。

    youdao

  • Both strncpy (3) and strncat (3) require that you give the amount of space left, not the total size of the buffer.

    strncpy(3)和strncat(3)都要求您给出剩余的空间,而不是给出缓冲区的总大小。

    youdao

  • The correct way to do this would be to use the strncpy function instead of strcpy , and give the maximum number of bytes to copy as BUFSIZ - 1.

    复制的正确方法是用strncpy函数代替strcpy,并将要复制的最大字节数定为BUFSIZ-1。

    youdao

  • The function strncpy(3) also doesn't NUL-terminate its destination if the source string is at least as long as the destination; this can cause havoc later.

    如果源字符串至少和目标一样长,那么函数strncpy(3)还不会使用NUL 来结束字符串;这可能会在以后导致严重破坏。

    youdao

  • This means that switching from strcpy (3) to strncpy (3) can reduce performance — often not a serious problem on today's computers, but it can still be a nuisance.

    这意味着从strcpy(3)切换到strncpy(3)会降低性能——这在如今的计算机上通常不是一个严重的问题,但它仍然是有害的。

    youdao

  • Then, we'll discuss two examples of the static approach (standard C strncpy/strncat and OpenBSD's strlcpy/strlcat), followed by two examples of the dynamic approach (SafeStr and C++'s std::string).

    然后,我们将讨论静态方法的两个例子(标准Cstrncpy/strncat和OpenBSD 的strlcpy/strlcat ),接着讨论动态方法的两个例子(SafeStr 和 C++ 的std::string )。

    youdao

  • Then, we'll discuss two examples of the static approach (standard C strncpy/strncat and OpenBSD's strlcpy/strlcat), followed by two examples of the dynamic approach (SafeStr and C++'s std::string).

    然后,我们将讨论静态方法的两个例子(标准Cstrncpy/strncat和OpenBSD 的strlcpy/strlcat ),接着讨论动态方法的两个例子(SafeStr 和 C++ 的std::string )。

    youdao

$firstVoiceSent
- 来自原声例句
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定
小调查
请问您想要如何调整此模块?

感谢您的反馈,我们会尽快进行适当修改!
进来说说原因吧 确定