Hello!
My fgets function never stops, although I set the limit to the string length that is excepted.

Code:
char string[100];

...
case 1: {
   //scanf(" %s",string);
   while (getchar() != '\n') {
      getchar();
   }
   fgets(string, 99,stdin);
   printf("\n");
   ...
}
I am trying to replace the commented scanf with the same thing but that would allow spaces.
I have never been using fgets, but I have read that it stops when sees the newline or end of file(not this case).

Can anyone suggest what could be the problem?

Thank you!