learnprogramming123

LEARN PROGRAMMING 123
your resources to programming and free tutition



Navigation

 
C
 
C++ soon here!
VB - soon here!

Search

 

 

Next Back

 

<errno.h>        -        Errors

If this header is included in a program, hen it is possible to detect whether an error has occurred during calls to certain library functions. After an error occurs the system variable erno will contain information about the error. The following symbolic constants are defined in the header file <errno.h> in response to either the DOS or UNIX error codes.

Jump to: demonstrate header <errno.h>

/* DOS Error Codes */

Number Function Description
     
0 EZERO no Error
1 EINVFM invalid function code
2 ENOENT file not found
3 ENOPATH path not found
4 EMFILE too many open files
5 EACCES access denied
6 EBADF invalid handle
7 E2BIG memory blocks destroyed
8 ENOMEM insufficient memory
9 ENVMEM invalid memory block address
10 EINVENV invalid environment
11 EINVFMT invlalid format
12 EINVACC invalid acces code
13 EINVDAT invalid data
15 ENODEV invalid drive
16 ECURDIR attempt to remove CurDir
17 ENOTSAM not same devide
18 ENMFILE no more files
     

/* RTL Error Codes */

19 EINVAL invalid argument
20 ENOTDIR not directory
21 EISDIR is directory
22 ENOEXEC corrupt exec file
32 EMLINK cross-device link
     
33 EDOM math argument
34 ERANGE result too large
36 EDEADLOCK file locking deadlock
80 EEXIST dile exists MSDOS 3.0+
     
-1 EFAULT unknown error
-1 EPERM UNIX - not in MSDOS
-1 ESRCH UNIX -not in MSDOS
-1 EINTR UNIX - not in MSDOS
-1 EIO UNIX - not in MSDOS
-1 ENXIO UNIX - not in MSDOS
-1 ECHILD UNIX - not in MSDOS
-1 EAGAIN UNIX - not in MSDOS
-1 ENOTBLK UNIX - not in MSDOS
-1 EBUSY UNIX - not in MSDOS
-1 ENFILE UNIX - not in MSDOS
-1 ENOTTY UNIX - not in MSDOS
-1 ETXTBSY UNIX - not in MSDOS
-1 EFBIG UNIX - not in MSDOS
-1 ENOTSPC UNIX - not in MSDOS
-1 ESPIPE UNIX - not in MSDOS
-1 EROFS UNIX - not in MSDOS
-1 EPIPE UNIX - not in MSDOS
-1 EUCLEAN UNIX - not in MSDOS
     

Program to demonstrate header <errno.h> :

#include <stdio.h>
#include <errno.h>
#include <math.h>
#include <limits.h>

int man(void)
{

    printf("%10.2G\n", sqrt(-1.0);
    printf("%d\n", errno);
    printf("%10.2G\n", exp(INF_MAX));
    printf("%d\n", errno);

    return 0;

}

Results from program:

0
33
1.8E+308
34

go to <float.h>        back to top        back to main

 






1