Menu

Quick console question

2002-09-15
2012-09-26
  • Nobody/Anonymous

    I'm using the newest version of Dev 4. I want to use something that waits for the user to hit a key, and then moves on without displaying the key. I thought that:
    char i;
    i = getch();
    would do this, but it displays the letter and waits until I press enter. How do I get around this?
       - Thanx in advance

     
    • Nobody/Anonymous

      just put

      getch();

      Curtis

      P.S.  getche();  will display what the user hit

       
    • Nobody/Anonymous

      Proper way to do this (use inp.Event.KeyEvent.wVirtualKeyCode or
      inp.Event.KeyEvent.uChar.AsciiChar):

      #include <windows.h>
      INPUT_RECORD inp;
      unsigned long w;
      ReadConsoleInput (GetStdHandle (STD_INPUT_HANDLE), &inp, 1, (LPDWORD) &w);

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.