📅  最后修改于: 2020-12-19 05:36:53             🧑  作者: Mango
C标准库的errno.h头文件定义了整数变量errno ,该整数变量由系统调用和某些库函数在发生错误的情况下设置,以指示出错的地方。该宏扩展为int类型的可修改的左值,因此可以被程序读取和修改。
程序启动时将errno设置为零。标准C库的某些功能会将其值修改为非零值,以表示某些类型的错误。您还可以方便地修改其值或将其重置为零。
errno.h头文件还定义了指示不同错误代码的宏列表,这些宏将扩展为int类型的整数常量表达式。
以下是标头errno.h中定义的宏-
Sr.No. | Macro & Description |
---|---|
1 |
extern int errno
This is the macro set by system calls and some library functions in the event of an error to indicate what went wrong. |
2 |
EDOM Domain Error
This macro represents a domain error, which occurs if an input argument is outside the domain, over which the mathematical function is defined and errno is set to EDOM. |
3 |
ERANGE Range Error
This macro represents a range error, which occurs if an input argument is outside the range, over which the mathematical function is defined and errno is set to ERANGE. |