title: using fgets as non-blocking function c++
body: <p>I'm writing a program that reads in a loop from the stdin, using the function fgets, as follows:  </p>
  
  <pre><code>while(fgets(buffer2, BUFFERSIZE , stdin) != NULL){
    //Some code  
  }
  </code></pre>
  
  <p>I want my code to be non-blocking, that is: I don't want the program to hold on the 'fgets' line when there's no input at the moment from the user.<br>
  How can i do it?</p>