Unfortunately, if c is char on a machine with unsigned chars, or it’s of type unsigned char, the EOF will never be detected.

 

 

 

  • while ((c = getchar()) != EOF) if (c == '\n') { /* entire record is now there */