cin.peek() is blocked after running stty raw Let’s limit the topic to determine whether an ESC or Up key is stroked by stardard c++.