errno:
-Stands for error number.
-Basically, this is the tool which can be use in exception Handling in C
How use in program?
#include< errno.h>
syntax:
errno;
Different error number with their meaning
errno Error
1// Operation not permitted
2//No such file or directory
3// No such process
4// Interrupted system call
5// I/O error
6// No such device or address
7// Argument list too long
8// Exec format error
9// Bad file number
10// No child processes
11// Try again
12// Out of memory
13// Permission denied
program-
#include < stdio.h>
#include < errno.h>
int main()
{
FILE * fp;
//open a file to read which can not exist
fp = fopen("Myfile.txt", "r");
printf("Error number is %dn ", errno);
return 0;
}
Error number is 2