title: fflush alternative
body: <p>I did the mistake of using fflush(stdin) to flush the remainings of the stdin stream like that:</p>
  
  <pre><code>printf("Gimme number");
  scanf("%d",&amp;number);
  fflush(stdin);
  printf("Gimme string");
  gets(string);
  </code></pre>
  
  <p>Of course I have included the header files and the rest.. I know that fflush is for stdout and NOT for stdin, but I badly need an alternative in order to use a gets after a scanf. I searched in old posts here but I only saw a suggestion about scanf("%c\n",c); . This drives the program to a nice crash when I do scanf("%d\n",x); Any ideas please?</p>