title: Check whether key is pressed down in Windows console
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2067893/c-console-keyboard-events">C++ console keyboard events</a>  </p>
  </blockquote>
  
  
  
  <p>I want a Windows console program to do something if a certain key is pressed down,
  something like</p>
  
  <pre><code>while(1)
  {
      ....
      if(the key 'o' is pressed down)
        ....
  }
  </code></pre>
  
  <p>but I don't know what to put in the <code>if</code> statement. How do I check if the key 'o' is pressed down?</p>
  
  <p>I'm using Windows 7 64-bit and Visual Studio Professional 2008.</p>