-
about EOF
I have used a while statement to test the EOF, if it sees EOF, the program should exit. I used command like this "my program<a.txt" and it worked, but when I ran it in the command prompt, I use control+Z to represent EOF, it did not work any more, thanks for any input!
Code:
char x;
while((x=getchar())!=EOF)
{
//my code
}
-
Just a guess... but this is a windows system?
CTRL-Z sending EOF is windows specific. On other systems, you should use CTRL-D.
-
EOF cannot fit in a char. You'll have to use int as is expect.
Quzah.
-
there is a detailed information about this in the FAQ Read this
ssharish2005