3 ms·
> putting the tty into cbreak or raw mode and then just reading keys from stdin You're saying this like most beginners even have an idea what a tty is. An ane
by divingdragon 6y ago
> putting the tty into cbreak or raw mode and then just reading keys from stdin
You're saying this like most beginners even have an idea what a tty is.
An anecdote: When I wrote my first C++ program that reads an input (using `cin`, hello-world style), I immediately wondered how to read single keys including arrow keys. The book I was following had nothing about this. I don't remember the exact details but a bit of Internet search got me to `conio.h` (I was using Dev-C++ on Windows) which did work. But getting it to work was so confusing to me at the time. And I didn't even get to understand what it's actually doing under the hood.
I imagine it would be a bit easier in Python given the right libraries, but the dependency management probably adds to the complexity for a beginner.