0

First time asking here. I've been looking around for quite a while and couldn't find an answer anywhere. I've had to build a calculator in C++ (boring stuff so tried to make it interesting) but couldn't find a way to wait for the next keyboard input and read it/store it. Something like keyboard events.

Cin requires the user to press enter every time and I don't want that. same for getchar, getch, cin.get(), etc...

If possible I'd like to avoid the inclusion other library than the basic ones.

Anyone knows how to ? Thanks.

Caelio
  • 19
  • 6
  • 2
    Does this answer your question? [Capture characters from standard input without waiting for enter to be pressed](https://stackoverflow.com/questions/421860/capture-characters-from-standard-input-without-waiting-for-enter-to-be-pressed) – Martheen Sep 14 '20 at 09:51

1 Answers1

1

The standard C++ libraries do not provide single-character input functions. You will need to use something like the curses library, which provides functions to do this.

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285