Me pregunto si si habrá algo igual o similar a la función kbhit() (para leer las pulsaciones de las teclas), por ejemplo en C/C++ y Python. He buscado en la documentación, pero no he hallado nada.
Translation: "Read keystrokes through the keyboard"
I wonder if there will be something equal or similar to the kbhit() function (to read keystrokes), for example in C/C++ and Python. I've searched the documentation, but haven't found anything.
I assume you mean to read input from the keyboard. That means reading from stdin - which is represented by io::stdin
. Now reading from any BufRead
"object" is same - you can read_line
to read lines. You can look at the methods of ReadBuf
and Read
to know more.
Edit: I think I misunderstood the question - you want to be able to detect immediately when a key is read. For that the TTY needs to be in raw mode. You can use termion
to do that. In particular the Keys
iterator I think would help your use-case.