Reputation: 21
I am trying to make a program that asks a user for input. I already know how to terminate the program after getting EOF.
if(feof(stdin)) exit(1);
Or,
while(!feof(stdin)) { ... }
By ignoring I mean that the program does nothing after catching EOF. Like signal handling:
signal(SIGTERM, no_op_function);
Upvotes: 0
Views: 338
Reputation: 21
Ok, here's what worked for me:
clearerr(stdin);
Thanks to @JonathanLeffler for the answer.
Upvotes: 1