NO

Author Topic: set errno when incorrect mode string is passed to fopen  (Read 120 times)

Offline ika

  • Member
  • *
  • Posts: 12
set errno when incorrect mode string is passed to fopen
« on: September 10, 2018, 03:34:55 am »
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.

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 1960
    • http://www.smorgasbordet.com
Re: set errno when incorrect mode string is passed to fopen
« Reply #1 on: September 16, 2018, 07:37:21 pm »
So, more of a feature request really? Yes, seems reasonable (will most likely be EINVAL).
/Pelle

Offline ika

  • Member
  • *
  • Posts: 12
Re: set errno when incorrect mode string is passed to fopen
« Reply #2 on: September 17, 2018, 02:02:49 am »
Yeah, you're right that I put this in the wrong forum. Thanks for the response!