errno - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <cerrno> |
||
|
|
||
errno é um pré-processador de macro que se expande a uma static(até C++11) / thread-local(desde C++11) modificável lvalue de int tipo. Várias funções de biblioteca padrão indicam erros, por escrito inteiros positivos para errno. Tipicamente, o valor de errno é definido como um dos códigos de erro, como listado na <cerrno> constantes de macros que começam com a letra E, seguido por letras maiúsculas ou dígitos.
Original:
errno is a preprocessor macro that expands to a static(até C++11) / thread-local(desde C++11) modifiable lvalue of type int. Several standard library functions indicate errors by writing positive integers to errno. Typically, the value of errno is set to one of the error codes, listed in <cerrno> as macro constants that begin with the letter E, followed by uppercase letters or digits.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
O valor da errno é 0 na inicialização do programa e, embora as funções da biblioteca é permitido escrever números inteiros positivos para errno ou não um erro, nunca bibliotecas de funções armazenar 0 em errno.
Original:
The value of errno is 0 at program startup, and although library functions are allowed to write positive integers to errno whether or not an error occurred, library functions never store 0 in errno.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exemplo
#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'; } }
Saída:
log(-1) failed: Numerical argument out of domain
Veja também
macros para condições normais POSIX-compatíveis erro Original: macros for standard POSIX-compatible error conditions The text has been machine-translated via Google Translate. (macro constante) [edit] | |
exibe uma seqüência de caracteres correspondente do erro atual para stderr Original: displays a character string corresponding of the current error to stderr The text has been machine-translated via Google Translate. (função) [edit] | |
retorna uma versão do texto de um código de erro apresentado Original: returns a text version of a given error code The text has been machine-translated via Google Translate. (função) [edit] | |