我在哪里可以找到使用sys_errlist的内容是什么? [英] Where can I find the contents of sys_errlist?

查看:1002
本文介绍了我在哪里可以找到使用sys_errlist的内容是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用sys_errlist是由错​​误号索引,并包含相应的错误信息。我在哪里可以看到这个列表的内容?

sys_errlist is indexed by errno and contains the appropriate error message. Where can I see the contents of this list?

推荐答案

也许在某些系统头文件包括通过某种<&errno.h中GT; 。如果你要打印的全部内容,你可以很容易地用小程序做到这一点:

Probably in some system header file included somehow by <errno.h>. If you want to print its full content you can easily do it with a small program:

#include <errno.h>
#include <stdio.h>

int main()
{
    for(int i=0; i<sys_nerr; i++)
        printf("sys_errlist[%d] = \"%s\"\n", i, sys_errlist[i]);
    return 0;
}

sys_nerr 被定义为条目的数量使用sys_errlist

不过,要记住的是,根据我的联机帮助, PERROR 字符串错误应该是preferred因为

Still, keep in mind that, according to my manpages, perror or strerror should be preferred since

新误差值可能没有被添加到使用sys_errlist []

new error values may not have been added to sys_errlist[].

这篇关于我在哪里可以找到使用sys_errlist的内容是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆