C++ Programming/Code/Standard C Library/Functions/perror

perror
The perror function writes, a ":" followed by a space, an implementation-defined and/or language-dependent error message corresponding to the global variable errno, and a newline to stderr. For example:

If the file called not_found.txt is not found, this code will produce the following output:

Error opening file 'not_found.txt': No such file or directory

If "str" is a null pointer or points to the null byte, only the error message corresponding to errno and a newline are written to stderr.


 * Related topics: clearerr - feof - ferror