The strncpy() function was designed with a very particular problem in mind: manipulating strings stored in the manner of original UNIX directory entries. These used a fixed sized array, and a nul-terminator was only used if the filename was shorter than the array.
C库有很多实现,不同平台/工具都有自己的实现
strncpy 函数的实现已经成了标准,如果新库实现跟以往不一样,
会使用户疑惑(加0使得实际拷贝字符数可能为n-1,与预期不符)!
而且有时候利用strncpy的非0结束特性来连接数组
——不建议这样用,但并不是没人这样用,特别是老的开源库