readdir(), strtol(), errno and you!

Usually when you call a function you can determine if there was an error based solely on the return code. But the functions readdir() strtol() and strtoll() are different. For these functions, if you want to know if there was an error then you must set errno to 0 before calling them. Then you can check whether errno is still 0 afterward.

Anyone know of any other common functions with the same behavior?

This entry was posted in All, Computers and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *