std::strerror
来自cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <cstring>
|
||
| char* strerror( int errnum ); |
||
返回的错误代码的文本版本
errnum。errnum的收购errno变量,函数接受任何int类型的值。该消息是特定于语言环境的.Original:
Returns text version of the error code
errnum. errnum is usually acquired from the errno variable, however the function accepts any value of type int. The message is locale-specific.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
。返回的字节字符串不能被修改通过该程序,但可能会被覆盖的后续调用
strerror功能 Original:
The returned byte string must not be modified by the program, but may be overwritten by a subsequent call to the
strerror function. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 。参数。
| errnum | - | 。积分值指的是一个错误代码。
Original: integral value referring to a error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
===。 返回值。===
。指针指向一个空终止字节的字符串对应的错误代码
errnum.Original:
Pointer to a null-terminated byte string corresponding to the error code
errnum.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[编辑] 。为例。
#include <iostream> #include <cmath> #include <cerrno> #include <cstring> int main() { double not_a_number = std::log(-1.0); if (errno == EDOM) { std::cout << "log(-1) failed: " << std::strerror(errno) << '\n'; } }
Output:
log(-1) failed: Numerical argument out of domain
[编辑] 。另请参阅。
| 宏为标准的POSIX兼容的错误条件 Original: macros for standard POSIX-compatible error conditions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (宏不变) | |
| C documentation for strerror
| |