Espacios de nombres
Variantes
Acciones

errno

De cppreference.com
< cpp‎ | error

 
 
Utilidades de la biblioteca
Escriba apoyo (basic types, RTTI, type traits)
Gestión de memoria dinámica
Gestión de errores
Programa de servicios públicos
Funciones variadic
Fecha y hora
Objetos Function
(C++11)
Operadores relacionales
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Pares y tuplas
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
Cambiar, hacia adelante y mover
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
 
Gestión de errores
Manejo de excepciones
Original:
Exception handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Fallas de control de excepciones
Original:
Exception handling failures
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(obsoleto)
(C++11)(obsoleto)
(obsoleto)
Categorías excepción
Original:
Exception categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Los códigos de error
Original:
Error codes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Los códigos de error
errno
Las afirmaciones
Original:
Assertions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
instalación SYSTEM_ERROR
Original:
system_error facility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
 
Definido en la cabecera <cerrno>
#define errno /*implementation-defined*/
errno es una macro de preprocesador que se expande a un static(hasta C++11) / thread-local(desde C++11) lvalue modificable de int tipo. Varias funciones de la librería estándar indican errores al escribir los números enteros positivos a errno. Normalmente, el valor de errno se establece en uno de los códigos de error, que se enumeran en <cerrno> como constantes macro que comienzan con la letra E, seguido de las letras en mayúsculas o dígitos .
Original:
errno is a preprocessor macro that expands to a static(hasta 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.
El valor de errno es 0 al inicio del programa, y ​​si bien las funciones de biblioteca se les permite escribir números enteros positivos a errno si se produce un error, nunca las funciones de biblioteca almacenar 0 en 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.

[editar] Ejemplo

[editar]
#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';
    }
}

Salida:

log(-1) failed: Numerical argument out of domain

[editar] Ver también

macros para las condiciones de error estándar POSIX compatibles
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.

(macro constante) [editar]
muestra una cadena de caracteres correspondiente del error actual a stderr
Original:
displays a character string corresponding of the current error to stderr
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [editar]
devuelve una versión de texto de un código de error
Original:
returns a text version of a given error code
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(función) [editar]