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 }