Fix the infamous getc() issue. getc() returns int to compare against EOF which is -1