set errno when incorrect mode string is passed to fopen

Started by ika, September 10, 2018, 03:34:55 AM

Previous topic - Next topic

ika

If you pass "rt" and "wt" (this is a Microsoft extension) to fopen in Pelles C 8, this does not cause any problems. However in Pelles C 9 it returns NULL. Of course "rt" and "wt" are nonstandard, so that isn't a problem, but errno is never set. So I didn't know what was wrong for a while, because while "strerror(errno)" says "no error", it is an error, which is why it returns NULL. So, I think it would be helpful for an error number and message to be added to strerror about passing in an incorrect mode string.

Pelle

So, more of a feature request really? Yes, seems reasonable (will most likely be EINVAL).
/Pelle

ika

Yeah, you're right that I put this in the wrong forum. Thanks for the response!