std::perror

Header: <cstdio>

Prints a textual description of the error code currently stored in the system variable errno to stderr.

# Declarations

void perror( const char *s );

# Parameters

# Return value

(none)

# Example

#include <cerrno>
#include <cmath>
#include <cstdio>
 
int main()
{
    double not_a_number = std::log(-1.0);
    if (errno == EDOM)
        std::perror("log(-1) failed");
    std::printf("%f\n", not_a_number);
}

# See also