In theory, strncpy (3) is the safe replacement for strcpy (3), but strncpy (3) also fills the entire destination with NULs once the end of the source string has been met.
从理论上讲,strncpy(3)是strcpy(3)的安全替代者,但是strncpy(3)还会在源字符串结束时使用nul来填充整个目标空间。
In theory, strncpy (3) is the safe replacement for strcpy (3), but strncpy (3) also fills the entire destination with NULs once the end of the source string has been met.
从理论上讲,strncpy(3)是strcpy(3)的安全替代者,但是strncpy(3)还会在源字符串结束时使用nul来填充整个目标空间。
应用推荐