Error Number In C
Contents |
in the future... /usr/include/asm-generic/errno-base.h #ifndef _ASM_GENERIC_ERRNO_BASE_H #define _ASM_GENERIC_ERRNO_BASE_H #define EPERM 1 /* Operation not permitted */ #define ENOENT 2 /* No such file or directory c errno example */ #define ESRCH 3 /* No such process */ #define EINTR 4 /*
Errno.h In C
Interrupted system call */ #define EIO 5 /* I/O error */ #define ENXIO 6 /* No such device or address
Errno C++
*/ #define E2BIG 7 /* Argument list too long */ #define ENOEXEC 8 /* Exec format error */ #define EBADF 9 /* Bad file number */ #define ECHILD 10 /* No child
How To Use Errno
processes */ #define EAGAIN 11 /* Try again */ #define ENOMEM 12 /* Out of memory */ #define EACCES 13 /* Permission denied */ #define EFAULT 14 /* Bad address */ #define ENOTBLK 15 /* Block device required */ #define EBUSY 16 /* Device or resource busy */ #define EEXIST 17 /* File exists */ #define EXDEV 18 /* Cross-device link */ #define ENODEV 19 /* errno python No such device */ #define ENOTDIR 20 /* Not a directory */ #define EISDIR 21 /* Is a directory */ #define EINVAL 22 /* Invalid argument */ #define ENFILE 23 /* File table overflow */ #define EMFILE 24 /* Too many open files */ #define ENOTTY 25 /* Not a typewriter */ #define ETXTBSY 26 /* Text file busy */ #define EFBIG 27 /* File too large */ #define ENOSPC 28 /* No space left on device */ #define ESPIPE 29 /* Illegal seek */ #define EROFS 30 /* Read-only file system */ #define EMLINK 31 /* Too many links */ #define EPIPE 32 /* Broken pipe */ #define EDOM 33 /* Math argument out of domain of func */ #define ERANGE 34 /* Math result not representable */ #endif /usr/include/asm-generic/errno.h #ifndef _ASM_GENERIC_ERRNO_H #define _ASM_GENERIC_ERRNO_H #include
of a library call. The functions strerror and perror give you the standard error message for a given error code; the variable program_invocation_short_name gives you convenient access to the name of the program errno to string that encountered the error. Function: char * strerror (int errnum) Preliminary: | MT-Unsafe race:strerror errno windows | AS-Unsafe heap i18n | AC-Unsafe mem | See POSIX Safety Concepts. The strerror function maps the error code (see Checking bad file number for Errors) specified by the errnum argument to a descriptive error message string. The return value is a pointer to this string. The value errnum normally comes from the variable errno. You should not modify http://www.virtsync.com/c-error-codes-include-errno the string returned by strerror. Also, if you make subsequent calls to strerror, the string might be overwritten. (But it’s guaranteed that no library function ever calls strerror behind your back.) The function strerror is declared in string.h. Function: char * strerror_r (int errnum, char *buf, size_t n) Preliminary: | MT-Safe | AS-Unsafe i18n | AC-Unsafe | See POSIX Safety Concepts. The strerror_r function works like strerror but instead of returning http://www.gnu.org/s/libc/manual/html_node/Error-Messages.html the error message in a statically allocated buffer shared by all threads in the process, it returns a private copy for the thread. This might be either some permanent global data or a message string in the user supplied buffer starting at buf with the length of n bytes. At most n characters are written (including the NUL byte) so it is up to the user to select a buffer large enough. This function should always be used in multi-threaded programs since there is no way to guarantee the string returned by strerror really belongs to the last call of the current thread. The function strerror_r is a GNU extension and it is declared in string.h. Function: void perror (const char *message) Preliminary: | MT-Safe race:stderr | AS-Unsafe corrupt i18n heap lock | AC-Unsafe corrupt lock mem fd | See POSIX Safety Concepts. This function prints an error message to the stream stderr; see Standard Streams. The orientation of stderr is not changed. If you call perror with a message that is either a null pointer or an empty string, perror just prints the error message corresponding to errno, adding a trailing newline. If you supply a non-null message argument, then perror prefixes its output with this string.
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies http://stackoverflow.com/questions/503878/how-to-know-what-the-errno-means of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: in c Sign up How to know what the 'errno' means? up vote 118 down vote favorite 33 When calling execl(...), I get an errno=2. What does it mean? How can I know the meaning of this errno? c linux errno share|improve this question edited Feb 18 '15 at 0:01 Peter Mortensen 10.2k1369107 asked Feb 2 '09 at 16:49 Barth 4,13194581 add a comment| 14 error number in Answers 14 active oldest votes up vote 200 down vote accepted You can use strerror() to get a human-readable string for the error number. This is the same string printed by perror() but it's useful if you're formatting the error message for something other than standard error output. For example: #include