ERRNO.H Header File in C
By: Kamini in C Tutorials on 2007-10-03
The header file ERRNO.H defines several macros used to define and document runtime errors. These macros are used in conjunction with the perror() function.
The ERRNO.H definitions include an external integer named errno. Many of the C library functions assign a value to this variable if an error occurs during function execution. The file ERRNO.H also defines a group of symbolic constants for these errors, listed in Table below.
The symbolic error constants defined in ERRNO.H.
|Name||Value||Message and Meaning|
|E2BIG||1000||Argument list too long (list length exceeds 128 bytes).|
|EACCES||5||Permission denied (for example, trying to write to a file opened for read only).|
|EBADF||6||Bad file descriptor.|
|EDOM||1002||Math argument out of domain (an argument passed to a math function was outside the allowable range).|
|EMFILE||4||Too many open files.|
|ENOENT||2||No such file or directory.|
|ENOEXEC||1001||Exec format error.|
|ENOMEM||8||Not enough core (for example, not enough memory to execute the exec() function).|
|ENOPATH||3||Path not found.|
|ERANGE||1003||Result out of range (for example, result returned by a math function is too large or too small for the return data type).|
You can use errno two ways. Some functions signal, by means of their return value, that an error has occurred. If this happens, you can test the value of errno to determine the nature of the error and take appropriate action. Otherwise, when you have no specific indication that an error occurred, you can test errno. If it's nonzero, an error has occurred, and the specific value of errno indicates the nature of the error. Be sure to reset errno to zero after handling the error.
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
- Data Science
- React Native
- Cloud Computing
- Java Beans
- Mac OS X
- Office 365
- Tech Reviews
Sum of the elements of an array in C
Printing a simple histogram in C
Find square and square root for a given number in C
Simple arithmetic calculations in C
Passing double value to a function in C
Passing pointer to a function in C
Infix to Prefix And Postfix in C
while, do while and for loops in C
if, if...else and switch statements in C with samples