Viewing and Printing the Errno Value

Your program can use the strerror() and perror() functions to print the value of errno. The strerror() function returns a pointer to an error message string that is associated with errno. The perror() function prints a message to stderr. The perror() and strerror() functions should be used immediately after a function is called because subsequent calls might alter the errno value.