linux条件下打印错误编码

这篇博客主要介绍如何在Linux系统下使用C语言来打印系统错误编码。作者提供了名为`error_list.c`的函数,通过编译并运行该程序,可以显示全部133个系统的错误消息。
摘要由CSDN通过智能技术生成

linux打印系统输出错误消息,linux系统内错误消息有133个,通过以下函数打印出来

函数名称error_list.c

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define ERRNO 133

int main() {
    int i;
    for (i = 0; i < ERRNO; i++) {
        printf("%d %s\n", i, strerror(i));
    }
}

编译代码

gcc -o error_list error_list.c

./error_list

输出结果有

0 Success
1 Operation not permitted
2 No such file or directory
3 No such process
4 Interrupted system call
5 Input/output error
6 No such device or address
7 Argument list too long
8 Exec format error
9 Bad file descriptor
10 No child processes
11 Resource temporarily unavailable
12 Cannot allocate memory
13 Permission denied
14 Bad address
15 Block device required
16 Device or resource busy
17 File exists
18 Invalid cross-device link
19 No such device
20 Not a directory
2
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值