title: Using kbhit() and getch() on Linux
body: <p>On Windows, I have the following code to look for input without interrupting the loop:</p>
  
  <pre><code>#include &lt;conio.h&gt;
  #include &lt;Windows.h&gt;
  #include &lt;iostream&gt;
  
  int main()
  {
      while (true)
      {
          if (_kbhit())
          {
              if (_getch() == 'g')
              {
                  std::cout &lt;&lt; "You pressed G" &lt;&lt; std::endl;
              }
          }
          Sleep(500);
          std::cout &lt;&lt; "Running" &lt;&lt; std::endl;
      }
  }
  </code></pre>
  
  <p>However, seeing that there is no <code>conio.h</code>, whats the simplest way of achieving this very same thing on Linux?</p>