ERRNO.H Header File in C

By: Kamini Emailed: 1728 times Printed: 2328 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

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).
EEXIST 80 File exists.
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.


C Home | All C Tutorials | Latest C Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(1)


1. View Comment

You have no way of knowing when errno was last set to nonzero, so in my opinion you should also set it to zero shortly *before* you intend to use it. Otherwise you may get a false error within the context of the current code.

View Tutorial          By: s.b at 2010-05-18 20:54:24

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Kamini
Importing the Certificate Reply from the CA example using keytool in Java
The switch Statement example in Java
Joins example in SQL
ERRNO.H Header File in C
XDoclet struts-config.xml in Struts
Macro Substitution using #define in C
Using Checkbox & Radio Tags, html:select, html:options in Struts Forms
Do while Loops in C
Functions in C
Opening files for read and write in C++
Operator Precedence in C++
StringItem sample program in J2ME
AWT-based applications with a User Interface Window in Java
store() and load() example in Java
Stray or Dangling Pointers in C++

More Tutorials in C
Sum of the elements of an array in C
Printing a simple histogram in C
Sorting an integer array in C
Find square and square root for a given number in C
Simple arithmetic calculations in C
Command-line arguments in C
Calculator 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
Unicode and UTF-8 in C
Formatting with printf in C
if, if...else and switch statements in C with samples
Statements in C

More Latest News
Most Viewed Articles (in C )
Using memset(), memcpy(), and memmove() in C
lseek() sample program in C
perror() Function - example program in C
UNIX read and write system calls sample program in C
assert() Function Example program in C
Find square and square root for a given number in C
Printing a simple histogram in C
Arrays of Structures example program in C
scanf and sscanf sample program in C
Listing Files and Directories sample program in C
Character Arrays in C
External Variables and Scope in C
goto and labels in C
Open, Creat, Close, Unlink system calls sample program in C
Using calloc() Function in C
Most Emailed Articles (in C)
scanf and sscanf sample program in C
Line Counting sample program in C
union example program in C
Variables and Arithmetic Expressions in C
Assignment Operators and Expressions in C
Command-line Arguments in C
Error Handling - Stderr and Exit - sample program in C
A Storage Allocator sample program in C
Using memset(), memcpy(), and memmove() in C
Writing The First C program
Infix to Prefix And Postfix in C
Getting Started with C
File Copying in C
Arrays sample program in C
Constants and escape sequences in C