使用一个简单程序来验证一下:
#include <stdio.h>
#include <string.h>
int main(int argc, char* argv[])
{
for(int i = -5; i < 50; i++)
printf("errno[%2d]: %s\n", i, strerror(i));
return 0;
}
输出
errno[-5]: Unknown error
errno[-4]: Unknown error
errno[-3]: Unknown error
errno[-2]: Unknown error
errno[-1]: Unknown error
errno[ 0]: No error
errno[ 1]: Operation not permitted
errno[ 2]: No such file or directory
errno[ 3]: No such process
errno[ 4]: Interrupted function call
errno[ 5]: Input/output error
errno[ 6]: No such device or address
errno[ 7]: Arg list too long
errno[ 8]: Exec format error
errno[ 9]: Bad file descriptor
errno[10]: No child processes
errno[11]: Resource temporarily unavailable
errno[12]: Not enough space
errno[13]: Permission denied
errno[14]: Bad address
errno[15]: Unknown error
errno[16]: Resource device
errno[17]: File exists
errno[18]: Improper link
errno[19]: No such device
errno[20]: Not a directory
errno[21]: Is a directory
errno[22]: Invalid argument
errno[23]: Too many open files in system
errno[24]: Too many open files
errno[25]: Inappropriate I/O control operation
errno[26]: Unknown error
errno[27]: File too large
errno[28]: No space left on device
errno[29]: Invalid seek
errno[30]: Read-only file system
errno[31]: Too many links
errno[32]: Broken pipe
errno[33]: Domain error
errno[34]: Result too large
errno[35]: Unknown error
errno[36]: Resource deadlock avoided
errno[37]: Unknown error
errno[38]: Filename too long
errno[39]: No locks available
errno[40]: Function not implemented
errno[41]: Directory not empty
errno[42]: Illegal byte sequence
errno[43]: Unknown error
errno[44]: Unknown error
errno[45]: Unknown error
errno[46]: Unknown error
errno[47]: Unknown error
errno[48]: Unknown error
errno[49]: Unknown error
标签:No,int,errno,strerror,C语言,Unknown,too,error
From: https://www.cnblogs.com/Yuan2036/p/16727517.html