I have refered previous questions but none of those helped. Issue is similar as mentioned here: Why does the terminal show "^[[A" "^[[B" "^[[C" "^[[D" when pressing the arrow keys in Ubuntu?
Executing g++(gcc11) and running it. Cannot move cursor using arrows.
Interestingly, while taking input in python does not have this issue.
Able to move cursor in Python3 input()
I have tried various things including using "bash" shell (3.2), using iTerm2 instead, running macos 11.4 in safe mode. Terminal app's key bindings are as default settings. None of the mentioned helped.
- How can this be avoided?
Edit: C++ Code:
#include <iostream>
using namespace std;
int main() {
string s;
cin>>s;
return 0;
}