Changed c to int instead of char. Necessary when comparing c to EOF.