When reading user input using getline(cin, mystrvar), some control keys don't work.
Example:
User input: abc^[[Dd
Text: abd
User input: asc
Read bytes: 7
#0: 97
#1: 98
#2: 99
#3: 27
#4: 91
#5: 68
#6: 100
I typed a, b, c, then left arrow and d. "Text:" apparently writes (cout) the first three characters, then sets the pointer to the left and overwrites the c. "asc" is a simple function that prints the length (mystrvar.size()) and ascii values.
When calling "stty -ctlecho" (system(...)), I am able to use the left arrow key, but it isn't limited to my input (I can overwrite "User input: ") plus the control codes are still being sent to my program.
This does not happen on Windows - I can use the arrow keys (even up/down for history) normally.
What's wrong here?
Edit: I'm mostly using Fedora 15. There doesn't seem to be any difference between lxterminal, terminal, xterm, konsole, gnome-terminal (as terminal) or bash, ksh, tcsh (as shell).