Careful! Errno can be set even when there is not an error.it's value is only relevant when the return value of the function indicates an error.
That said there are some functions where the possible return values can't indicate an error. In those cases errno should be set to zero before the function call and then a change during will alert you to an error.
Why it's like this I have no idea but it's pretty annoying.
That said there are some functions where the possible return values can't indicate an error. In those cases errno should be set to zero before the function call and then a change during will alert you to an error.
Why it's like this I have no idea but it's pretty annoying.