perror
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <stdio.h>
  | 
||
|   void perror( const char *s );  | 
||
打印当前存储于系统变量 errno 的错误码到 stderr 。
通过连接下列组分构成描述:
-  
s所指向的空终止字节字符串的内容后随 ": " (除非s为空指针或s所指向字符为空字符) -  实现定义的,描述存储于 
errno的错误码的错误消息字符串后随 '\n' 。错误消息字符串等同于 strerror(errno) 的结果。 
参数
| s | - | 指向带解释消息的空终止字符串的指针 | 
返回值
(无)
示例
运行此代码
输出:
fopen() failed: No such file or directory
引用
- C11 standard (ISO/IEC 9899:2011):
 
- 7.21.10.4 The perror function (p: 339)
 
- C99 standard (ISO/IEC 9899:1999):
 
- 7.19.10.4 The perror function (p: 305)
 
- C89/C90 standard (ISO/IEC 9899:1990):
 
- 4.9.10.4 The perror function
 
参阅
|    (C11)(C11)  | 
   返回给定错误码的文本版本  (函数)  |