Hacker News new | ask | show | jobs
by st_goliath 1420 days ago
> fgetc() does not return 'char', it returns 'int' else EOF won't fit.

Or more precisely: don't store the return value in a 'char' and check if it is EOF. On some platforms (e.g. gcc ARM eabi), regular 'char' is unsigned and the check fails.