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