title: Why won't fflush(stdin) work?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2979209/using-fflushstdin">Using fflush(stdin)</a>  </p>
  </blockquote>
  
  
  
  <p>My code is: </p>
  
  <pre><code>scanf("%d", &amp;_choice);
  fflush(stdin);
  gets(input);
  </code></pre>
  
  <p>I use <code>fflush(stdin);</code> to remove the <code>'\n'</code> character that was left after <code>scanf</code>.</p>
  
  <p>However, I found out that it doesn't work, and <code>gets</code> automatically takes the <code>'\n'</code> char and continues.</p>
  
  <p>I solved it by using <code>getchar()</code> instead of <code>fflush</code> but I still can't figure out why didn't <code>fflush</code> work...</p>
  
  <p><strong>Edit:</strong> I understand now <code>fflush</code> is for output streams only. 
  But is there a command for "cleaning" <code>stdin</code> from junk?</p>