0

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);
Rob
  • 14,746
  • 28
  • 47
  • 65

1 Answers1

1

Ok, here's what worked for me:

clearerr(stdin);

Thanks to @JonathanLeffler for the answer.