1. *** stack smashing detected *** (堆栈溢出) 原因出错段附近的数组越界。 2. strncpy 函数 例 : strncp (a, b, 6); 是将b中的前6个字符复制到a中,并不会给a自动添加字符串的结束标志。