Thanks JD200, but the point is that any statement immediately following fgets() is never executed if there is no input available on stdin.
I nevertheless tried your suggestion (inserting exec()), but without success.