ERROR 常数

来源:互联网 发布:怎么做淘宝店铺 编辑:程序博客网 时间:2024/04/30 13:37
#include <errno.h>
备注

errno 值是常数分配给 errno 在各种错误状态的情况下。

ERRNO.H 包含 errno 值的定义。 但是,并非在 ERRNO.H 提供的所有定义用于 32 位 windows 操作系统。 在某些 ERRNO.H 的值存在保持与操作系统 UNIX 系列的兼容性。

在 32 位 windows 操作系统的 errno 值是的子集 errno 中 XENIX 系统。 因此, errno 值不一定是实际错误代码返回从 windows 操作系统调用的相同。 访问实际操作系统错误代码,使用 _doserrno 变量,包含该值。

下面 errno 值支持:

ECHILD

未给出的过程。

EAGAIN

不处理。 尝试创建新进程失败,因为没有处理槽,或者没有足够的内存,或者最大嵌套级别已到达。

E2BIG

太长的参数列表。

EACCES

权限被拒绝。 文件的权限集不允许指定的访问。 此错误指示尝试访问一个文件 (或者,在某些情况下,一个目录) 将与文件属性不兼容的方法。

例如,该错误,当尝试从不处于打开状态时的文件读取,打开要编写的现有只读文件,或打开目录而不是文件。 在 MS-DOS 操作系统版本 3.0 下及更高版本中, EACCES 还可以指示锁定的或共享的冲突。

该错误还可能生成用于写入文件或目录重命名或移除现有目录。

EBADF

文件号错误。 有两种原因:1) 中指定的文件描述符不是有效的值也不引用打开文件。 2) 尝试对进行只读访问或设备编写打开的文件。

EDEADLOCK

资源会发生死锁。 为算术函数的参数不在函数的字段。

EDOM

算术参数。

EEXIST

文件存在。 尝试创建已存在的文件。 例如, _O_CREAT 和 _O_EXCL 标志。 _open 指定调用,但是,名称文件已存在。

EILSEQ

非法字节序列 (例如,在 MBCS 字符串)。

EINVAL

无效参数。 无效值为之一传递给定函数。 例如,对于原点给定的值,在确定文件指针 (传递给 fseek的调用) 是文件的开头之前。

EMFILE

许多打开文件。 没有其他文件描述符不可用,因此,不能打开没有其他文件。

ENOENT

如果没有这样的文件或目录。 使用指定的文件或目录不存在或无法找到。 此消息会发生,只要已指定的文件不存在或路径的元素不指定某个现有目录。

ENOEXEC

exec 格式错误。 尝试执行不可执行文件或具有无效可执行 (pe) 文件格式的文件。

ENOMEM

没有足够的核心。 没有足够的内存为所尝试的运算符可用。 例如,此消息时,会发生内存不足可用于执行子进程时,或者,在 _getcwd 的分配请求调用时无法得到满足。

ENOSPC

在计算机预留的没有空格。 编写没有其他空间不在计算机 (例如,那么,当磁盘已满时)。

ERANGE

太大结果。 为算术函数的参数太大,从而部分或完全有效位丢失中的位数。 此错误在其他功能,也可能作为参数比预期大时 (例如,那么,当对 _getcwd 的 缓冲区 参数比预期长) 时。

EXDEV

跨模式链接。 尝试将文件移动到不同的计算机 (使用 重命名 函数)。

STRUNCATE

字符串复制或串联生成一个被截断的字符串。 请参见 _TRUNCATE

以下值对使用 POSIX 的兼容性支持。 它们是在非 POSIX 系统需要的值。

#define E2BIG [argument list too long]#define EACCES [permission denied]#define EADDRINUSE [address in use]#define EADDRNOTAVAIL [address not available]#define EAFNOSUPPORT [address family not supported]#define EAGAIN [resource unavailable try again]#define EALREADY [connection already in progress]#define EBADF [bad file descriptor]#define EBADMSG [bad message]#define EBUSY [device or resource busy]#define ECANCELED [operation canceled]#define ECHILD [no child process]#define ECONNABORTED [connection aborted]#define ECONNREFUSED [connection refused]#define ECONNRESET [connection reset]#define EDEADLK [resource deadlock would occur]#define EDESTADDRREQ [destination address required]#define EDOM [argument out of domain]#define EEXIST [file exists]#define EFAULT [bad address]#define EFBIG [file too large]#define EHOSTUNREACH [host unreachable]#define EIDRM [identifier removed]#define EILSEQ [illegal byte sequence]#define EINPROGRESS [operation in progress]#define EINTR [interrupted]#define EINVAL [invalid argument]#define EIO [io error]#define EISCONN [already connected]#define EISDIR [is a directory]#define ELOOP [too many synbolic link levels]#define EMFILE [too many files open]#define EMLINK [too many links]#define EMSGSIZE [message size]#define ENAMETOOLONG [filename too long]#define ENETDOWN [network down]#define ENETRESET [network reset]#define ENETUNREACH [network unreachable]#define ENFILE [too many files open in system]#define ENOBUFS [no buffer space]#define ENODATA [no message available]#define ENODEV [no such device]#define ENOENT [no such file or directory]#define ENOEXEC [executable format error]#define ENOLCK [no lock available]#define ENOLINK [no link]#define ENOMEM [not enough memory]#define ENOMSG [no message]#define ENOPROTOOPT [no protocol option]#define ENOSPC [no space on device]#define ENOSR [no stream resources]#define ENOSTR [not a stream]#define ENOSYS [function not supported]#define ENOTCONN [not connected]#define ENOTDIR [not a directory]#define ENOTEMPTY [directory not empty]#define ENOTRECOVERABLE [state not recoverable]#define ENOTSOCK [not a socket]#define ENOTSUP [not supported]#define ENOTTY [inappropriate io control operation]#define ENXIO [no such device or address]#define EOPNOTSUPP [operation not supported]#define EOTHER [other]#define EOVERFLOW [value too large]#define EOWNERDEAD [owner dead]#define EPERM [operation not permitted]#define EPIPE [broken pipe]#define EPROTO [protocol error]#define EPROTONOSUPPORT [protocol not supported]#define EPROTOTYPE [wrong protocol type]#define ERANGE [result out of range]#define EROFS [read only file system]#define ESPIPE [invalid seek]#define ESRCH [no such process]#define ETIME [stream timeout]#define ETIMEDOUT [timed out]#define ETXTBSY [text file busy]#define EWOULDBLOCK [operation would block]#define EXDEV [cross device link]
 下面是error相关的返回值
   1#ifndef _ASM_GENERIC_ERRNO_BASE_H
   2#define _ASM_GENERIC_ERRNO_BASE_H
   3
   4#define EPERM            1      /* Operation not permitted */操作禁止
   5#define ENOENT           2      /* No such file or directory */文件或者目录不存在
   6#define ESRCH            3      /* No such process */相应的进程不存在
   7#define EINTR            4      /* Interrupted system call */中断系统调用
   8#define EIO              5      /* I/O error */I/O错误
   9#define ENXIO            6      /* No such device or address */相应设备或者地址不存在
  10#define E2BIG            7      /* Argument list too long */参数列表太长
  11#define ENOEXEC          8      /* Exec format error */Exec格式错误
  12#define EBADF            9      /* Bad file number */错误的文档编号
  13#define ECHILD          10      /* No child processes */没有子进程
  14#define EAGAIN          11      /* Try again */ 重试
  15#define ENOMEM          12      /* Out of memory */溢出内存
  16#define EACCES          13      /* Permission denied */没有权限
  17#define EFAULT          14      /* Bad address */错误的地址
  18#define ENOTBLK         15      /* Block device required */块设备需求
  19#define EBUSY           16      /* Device or resource busy */设备或者资源繁忙
  20#define EEXIST          17      /* File exists */文件已经存在
  21#define EXDEV           18      /* Cross-device link */交叉链接设备
  22#define ENODEV          19      /* No such device */没有对应的设备
  23#define ENOTDIR         20      /* Not a directory */不是路径
  24#define EISDIR          21      /* Is a directory */是路径,与上面意思相反
  25#define EINVAL          22      /* Invalid argument */无效参数
  26#define ENFILE          23      /* File table overflow */文件表溢出
  27#define EMFILE          24      /* Too many open files */打开的文件太多了
  28#define ENOTTY          25      /* Not a typewriter */非打印机
  29#define ETXTBSY         26      /* Text file busy */文本文件繁忙
  30#define EFBIG           27      /* File too large */文件太大
  31#define ENOSPC          28      /* No space left on device */没有足够的空间留给设备使用
  32#define ESPIPE          29      /* Illegal seek */非法定位
  33#define EROFS           30      /* Read-only file system */只读文件系统
  34#define EMLINK          31      /* Too many links */太多的链接
  35#define EPIPE           32      /* Broken pipe */管道中断
  36#define EDOM            33      /* Math argument out of domain of func */??
  37#define ERANGE          34      /* Math result not representable */非数字结果
  38
  39#endif
  40 
0 0
原创粉丝点击