在线文档教程
C++
应用 | Utilities

Error numbers

误差号

中定义的每个宏<cerrno>展开为具有类型的整数常量表达式。int,每个值都是正数,与大多数POSIX错误码定义了以下常量%28实现可以定义更多的常量,只要它们开始于'E'后面跟着数字或大写字母%29。

在标头中定义<cerrno>

*。

E2BIG%28C++11%29参数列表太长,%28宏常数%29

EACCES%28C++11%29权限被拒绝%28宏常量%29

使用中的EADDRINUSE%28C++11%29地址%28宏常数%29

EADDRNOTAVAIL%28C++11%29地址不可用%28宏常数%29

EAFNOSUPPORT%28C++11%29地址家庭不支持%28宏常数%29

EAGAIN%28C++11%29资源不可用,请重试%28宏常数%29

eodie%28C++11%29连接已在进行中%28宏常数%29

EBADF%28C++11%29坏文件描述符%28宏常数%29

EBADMSG%28C++11%29坏消息%28宏常数%29

EBUSY%28C++11%29设备或资源繁忙%28宏常数%29

ECANCELED%28C++11%29操作取消%28宏常数%29

ECHILD%28C++11%29没有子进程%28宏常数%29

终止%28宏常数%29的连接终止%28C++11%29

经济价值%28C++11%29连接拒绝%28宏常数%29

ECNNRESET%28C++11%29连接重置%28宏常数%29

EDEADLK%28C++11%29资源死锁将发生%28宏常数%29

EDESTADDRREQ%28C++11%29目标地址要求%28宏常数%29

Edom数学论证超出函数域%28宏常数%29

EEXIST%28C++11%29文件存在%28宏常量%29

EFAULT%28C++11%29坏地址%28宏常数%29

EFBIG%28C++11%29文件太大,%28宏常数%29

EHOSTUNEACH%28C++11%29主机不可达%28宏常数%29

EIDRM%28C++11%29标识符删除%28宏常数%29

EILSEQ%28C++11%29非法字节序列%28宏常数%29

EINPROGRESS%28C++11%29正在进行中的操作28宏常数%29

EINTR%28C++11%29中断函数%28宏常数%29

EINVAL%28C++11%29无效参数%28宏常数%29

EIO%28C++11%29 I/O错误%28宏常数%29

EISCONN%28C++11%29套接字连接%28宏常数%29

EISDIR%28C++11%29是目录%28宏常量%29

ELOOP%28C++11%29太多级别的符号链接%28宏常量%29

EMFILE%28C++11%29文件描述符值过大

EMLINK%28C++11%29太多链接%28宏常数%29

EMSGSIZE%28C++11%29消息太大%28宏常数%29

ENANAMETOOLONG%28C++11%29文件名过长%28宏常数%29

ENETDOWN%28C++11%29网络下降%28宏常数%29

网络%28宏常数%29中止的ENETRESET%28C++11%29连接

ENETUNEACH%28C++11%29网络不可达%28宏常数%29

在系统%28宏常量%29中打开的文件太多了

ENOBUFS%28C++11%29无可用缓冲区空间%28宏常数%29

ENODATA%28C++11%29在流头读取队列%28宏常量%29上没有消息可用

ENODEV%28C++11%29没有这类设备%28宏常数%29

ENOENT%28C++11%29没有这样的文件或目录%28宏常量%29

ENOEXEC%28C++11%29可执行文件格式错误%28宏常量%29

ENOLCK%28C++11%29无锁可用%28宏常数%29

ENOLINK%28C++11%29链接被切断%28宏常数%29

ENOMEM%28C++11%29不够空间%28宏常数%29

ENOMSG%28C++11%29没有所需类型的消息%28宏常量%29

ENOPROTOOPT%28C++11%29协议不可用%28宏常数%29

ENOSPC%28C++11%29设备上没有剩余空间28宏常数%29

ENOSR%28C++11%29无流资源%28宏常数%29

ENOSTR%28C++11%29不是流%28宏常数%29

ENOSYS%28C++11%29函数不支持%28宏常数%29

ENOTCONN%28C++11%29套接字未连接%28宏常数%29

ENOTDIR%28C++11%29不是目录%28宏常数%29

ENOTEMPTY%28C++11%29目录没有空%28宏常数%29

ENOTRECOVERABLE%28C++11%29状态不可恢复%28宏常数%29

ENOTSOCK%28C++11%29不是套接字%28宏常数%29

ENOTSUP%28C++11%29不支持%28宏常数%29

ENOTTY%28C++11%29不合适的I/O控制操作%28宏常数%29

ENXIO%28C++11%29没有这样的设备或地址%28宏常数%29

EOPNOTSUPP%28C++11%29不支持套接字%28宏常数%29的操作

EOVERFLOW%28C++11%29值太大,不能存储在数据类型%28宏常数%29中

前业主死亡百分比28宏常量%29

EPERM%28C++11%29操作不允许%28宏常数%29

EPIPE%28C++11%29断管%28宏常数%29

EPROTO%28C++11%29协议错误%28宏常数%29

EPROTONOSUPPORT%28C++11%29协议不支持%28宏常数%29

EPROTOTYPE%28C++11%29协议套接字%28宏常数%29错误类型

eRange结果太大,%28宏常数%29

EROFS%28C++11%29只读文件系统%28宏常量%29

ESPIPE%28C++11%29无效查找%28宏常数%29

ESRCH%28C++11%29没有这类进程%28宏常数%29

eTime%28C++11%29流ioctl%28%29超时%28宏常数%29

ETIMEDOUT%28C++11%29连接超时%28宏常数%29

ETXTBSY%28C++11%29文本文件忙%28宏常量%29

EWOULDBLOCK%28C++11%29操作将阻止%28宏常数%29

EXDEV%28C++11%29交叉设备链路%28宏常数%29

所有值都必须是唯一的,除非EOPNOTSUPPENOTSUP的值可能是相同的。EAGAINEWOULDBLOCK可能是一样的。

二次

#include <iostream> #include <cmath> #include <cerrno> #include <cstring> #include <clocale> int main() { double not_a_number = std::log(-1.0 if (errno == EDOM) { std::cout << "log(-1) failed: " << std::strerror(errno) << '\n'; std::setlocale(LC_MESSAGES, "de_DE.utf8" std::cout << "Or, in German, " << std::strerror(errno) << '\n'; } }

二次

可能的产出:

二次

log(-1) failed: Numerical argument out of domain Or, in German, Das numerische Argument ist ausserhalb des Definitionsbereiches

二次

另见

errc (C++11)the std::error_condition enumeration listing all standard macro constants (class)
errnomacro which expands to POSIX-compatible thread-local error number variable(macro variable)
perrordisplays a character string corresponding of the current error to stderr (function)
strerrorreturns a text version of a given error code (function)

c错误编号文档

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/Error/errno[医]宏