Error Codes Associated with errorno in C++
There are lots of codes associated with errorno in C++ but some of the commonly used error codes are listed in the below table:
errorno Code |
Associated Macro |
Description |
---|---|---|
1 | EPERM | Operation not permitted |
2 | ENOENT | No such file or directory |
3 | ESRCH | No such process |
5 | EIO | I/O error |
7 | E2BIG | Argument list too long |
9 | EBADF | Bad file number |
10 | ECHILD | No child processes |
11 | EAGAIN | Try again |
12 | ENOMEM | Out of memory |
13 | EACCES | Permission denied |
How to use errno in C++?
In C++ errno
is a preprocessor macro that is used for error indication and reporting errors that occur during a function call. It contains error codes so if a call to a function fails somehow then the errno is set to a value that corresponds to the error.
errno is defined in the header file <cerrno>
i
n C++.
Contact Us