Latest web development tutorials

C standard library - <errno.h>

Brief introduction

C standard libraryerrno.h header file defines the integer variable errno,which is set by system calls, library functions in some error event indicates what error has occurred. This macro expands to the left of type int value can change, so it can be read and modify a program.

When the programstarts, errno is set to zero, C standard library specific function to modify its value is non-zero value to indicate the number of certain types of errors.You can also modify its value or reset to zero at the appropriate time.

errno.h header files to the top of the range represents a different error code macros should be extended to inttype integer constant expressions.

Macro library

The following lists the macros defined in the header file errno.h:

序号宏 & 描述
1 extern int errno
这是通过系统调用设置的宏,在错误事件中的某些库函数表明了什么发生了错误。
2 EDOM Domain Error
这个宏表示一个域错误,它在输入参数超出数学函数定义的域时发生,errno 被设置为 EDOM。
3 ERANGE Range Error
这个宏表示一个范围错误,它在输入参数超出数学函数定义的范围时发生,errno 被设置为 ERANGE。