If errno contains a nonzero number, is there an error? Ans. The global variable errno is used by many standard C library functions to pass back to your program an error code that denotes specifically which error occurred. However, your program should not check the value of errno to determine whether an error occurred. Usually, the standard C library function you are calling returns with a return code which denotes that an error has occurred and that the value of errno has been set to a specific error number. If no error has occurred or if you are using a library function that does not reference errno, there is a good chance that errno will contain an erroneous value. For performance enhancement, the errno variable is sometimes not cleared by the functions that use it. You should never rely on the value of errno alone; always check the return code from the function you are calling to see whether errno should be referenced. Refer to your compiler's library documentation for references to functions that utilize the errno global variable and for a list of valid values for errno. - Study24x7
Social learning Network
11 Apr 2023 01:13 PM study24x7 study24x7

If errno contains a nonzero number, is there an error? Ans. The global variable errno is used by many standard C library functions to pass back to your program an error code that denotes specifically which error occurred. However, your program should not check the value of errno...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles