Oops, so it is. But another question:
Say I have this:
Shouldn't CTRL-Z force the EOF at any time, even before a newline has been sent? Or does nothing happen until the newline flushes the buffer?
int ct = 0;
while ((ch = getchar()) != EOF)
printf("%d characters read\n", ct);
Yet when I run this and type a few characters on one line, ending with a CTRL-Z and a newline, the program prints the ^Z then goes onto the new line and continues. Only then, if I type another ^Z and Enter will the program break out of the loop. I thought I understood what was going on with getchar() and EOF but it appears I was wrong!