std::strerror
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>| Dclar dans l'en-tte <cstring>
|
||
char* strerror( int errnum ); |
||
Retourne la version texte de la
errnum code d'erreur. errnum est gnralement acquise partir de la variable errno, mais la fonction accepte tout type de valeur de int. Le message est spcifique la localisation .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.
La chane d'octets retourns ne doivent pas tre modifis par le programme, mais peut tre remplace par un appel ultrieur la fonction
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.
Paramtres
| errnum | - | valeur intgrale se rfrant un code d'erreur
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. |
Retourne la valeur
Pointeur vers une chane d'octets termine par NULL correspondant la
errnum code d'erreur .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.
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';
}
}
Rsultat :
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) | |
C documentation for strerror
| |