errno
De 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. |
<metanoindex/>
<tbody> </tbody>| Déclaré dans l'en-tête <cerrno>
|
||
#define errno /*implementation-defined*/ |
||
errno est une macro du préprocesseur qui se dilate à une static (avant C++11) / thread-local (depuis C++11) modifiables lvalue de int type. Plusieurs fonctions de bibliothèque standard indiquent des erreurs en écrivant des entiers positifs à errno. En règle générale, la valeur de errno est réglé sur l'un des codes d'erreur, énumérés à l'<cerrno> comme des constantes macro qui commencent par la lettre E, suivie par des lettres majuscules ou chiffres .Original:
errno is a preprocessor macro that expands to a static (avant C++11) / thread-local (depuis 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.
You can help to correct and verify the translation. Click here for instructions.
La valeur de
errno est 0 au démarrage du programme, et bien que les fonctions de bibliothèque sont autorisés à écrire des nombres entiers positifs à errno si oui ou non une erreur s'est produite, fonctions de bibliothèque ne jamais stocker 0 dans 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.
You can help to correct and verify the translation. Click here for instructions.
Exemple
#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';
}
}
Résultat :
log(-1) failed: Numerical argument out of domain
Voir aussi
macros pour des conditions standard d'erreur compatible 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. (constante macro) | |
affiche une chaîne de caractères correspondant de l'erreur de courant à 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. (fonction) | |
renvoie une version texte d'un code d'erreur indiqué 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. (fonction) | |