描述 C 库函数 void perror(const char *str) 把一个描述性错误消息输出到标准错误 stderr。 首先输出字符串 str,后跟一个冒号,然后是一个空格。 下面看一下perror函数与printf函数的对比: 1)printf() #include <stdio.h> int main () { FILE *fp; rename("file.txt",