0

I am new in C programming, but already have written few projects with it. Once I was playing with dosbox and Borland C++. I found, that in conio.h exists getch() function to get keyboard input without echoing. And I disappointed, that I have no something like this on Linux. Only ncurses getch(). So now I am trying to figure out, how can I implement getch() function (like in ncurses or conio.h) myself.

Thank you in advance!

  • 1
    Nothing in standard C does that. You'll need to use platform-specific calls, and are better off using one of the libraries you've already mentioned. – Stephen Newell Mar 13 '22 at 19:21
  • Is it solution to use termios.h on linux to turn off canonical mode of terminal and wait input without enter-key? – Ilya Bezrukov Mar 13 '22 at 19:26
  • "And I disappointed, that I have no something like this on Linux."... but NCurses getch() give you such possibility. Just use `noecho()` which is included to NCurses. It will give possibility to take user input to getch() without showing it on screen – igroglaz Sep 18 '22 at 16:25
  • @igroglaz, I mean I want to have same functionality without using ncurses. I do not want link it in my projects. – Ilya Bezrukov Oct 17 '22 at 12:08

0 Answers0