首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> C語言 >> C++ >> 關於C++

Linux errno 錯誤代碼對照表

     編輯:關於C++

errno 定義

errno 定義於 <errno.h>,錯誤宏分佈在 /usr/include/asm-generic/errno-base.h (1-34) 和 errno.h (35-132)。

打印對照表程序

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

int main() {
    for (int i = 0; i < 140; ++i) {
        errno = i;
        printf("errno %d :\t\t%s\n", i, strerror(errno));
    }
    return 0;
}

常見錯誤碼速查

errno宏描述
1EPERMOperation not permitted
2ENOENTNo such file or directory
11EAGAINResource temporarily unavailable
12ENOMEMCannot allocate memory
13EACCESPermission denied
22EINVALInvalid argument
24EMFILEToo many open files
28ENOSPCNo space left on device
32EPIPEBroken pipe
98EADDRINUSEAddress already in use
104ECONNRESETConnection reset by peer
110ETIMEDOUTConnection timed out
111ECONNREFUSEDConnection refused
113EHOSTUNREACHNo route to host

完整列表見內核頭文件源碼附錄。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved