My EOF check tested as 0 when EOF was reached and 1 when false. I included both exercises 6 and 7 in once simple program.
$>./filecopy.o < mytextfile.txt
The expression getchar() != EOF evaluates to: 1 when false.
ello, my name is Denis and I live in a house. My house is in Montreal and at night I eat dinner.
The value of check is: 0 when true.
EOF = -1
$>vim filecopy.c
1 #include <stdio.h>
2
3 int main(void){
4
5 int c, check;
6 system("clear");
7 c = getchar() != EOF;
8 printf("The expression getchar() != EOF evaluates to: %d when false.\n",c);
9 while ((c = getchar()) != EOF )
10 putchar(c);
11
12 check = getchar() != EOF; //save the value of the check
13 printf("The value of check is: %d when true.\n",check); //print the value of the check
14 printf("EOF = %d\n",EOF);
15 }