Most library functions return a special value to indicate that they have failed.
But this return value tells you only that an error has occurred. To find out what kind of error it was, you need to look at the error code stored in the variable errno . The variable errno contains the system error number. You can change the value of errno . However, a properly written signal handler saves and restores the value of errno , so you generally do not need to worry about this possibility except when writing signal handlers.