errno
linux中输入man perror 命令,如下
#include <stdio.h>
void perror(const char *s);
#include <errno.h>
const char * const sys_errlist[];
int sys_nerr;
int errno; /* Not really declared this way; see errno(3) */
errno定义在errno.h中,在系统调用或库函数调用失败,值就会改变。errno值不同,对应不同的错误信息。
打印errno值含义
#include <string.h> /* for strerror */
#include <errno.h>
#include <stdio.h>
int main(int argc, char ** argv) {
int i = 0;