Ok. I have read it, I think I am understanding it. This was also covered in the text book. So I it seems my while loop, which is there to discard input longer than 5 is causing a problem. So the problem is if the input is too short fgets() swallows my \n and getchar() in the while loop is waiting until it sees an \n. But if input is too long this is not the case. Is that right?
So I guess I could put in a strlen after fgets to see how long the captured string is and if it is shorter than needed I will skip the while loop. Would that work? Is there a more elegant solution?
printf("\nEnter flight number: ");
fgets(entry, 5, stdin);
while(getchar() != '\n')