How to handle keyboard and caret in terminal?

I am writing console program. It uses xterm, gnome terminal or another.
I am using getline( cin, table )
If I press arrow up , it write ^[[A, but I want history, also serving Home, End, control + Left/Right and Tab. How distinguish special keyboard in all terminals and move caret to begin/end/left,right word?
Use, e.g. GNU Readline:
https://ftp.gnu.org/gnu/readline/

If you have a problem with the license (GPL), there are a few alternatives.
libedit, for example:
http://thrysoee.dk/editline/
Last edited on
Topic archived. No new replies allowed.