tags:

views:

67

answers:

1

I have a very simple code:

char character;    
std::cin >> character;

However, I would like it to behave as follow:

  1. Don't echo to console the character I type
  2. std::cin should return (unblock) right away when a character is pressed without having to press the Enter key

Is this possible? I also have access to Qt.

+4  A: 

This is going to be platform dependent, but you can use

getch() which is part of conio.h if you're on windows

or

getch() as part of curses.h if you're on *nix

References

Jamie Wong
This answer is concise, and plain awesome.
ShaChris23