Recognizing arrow keys with stdin

前端 未结 4 1889
广开言路
广开言路 2020-12-09 05:34

is it possible to have a cross-platform way to handle backspace and arrows keys within a C or OCaml program?

Actually an OCaml solution would be appreciated but many

4条回答
  •  旧巷少年郎
    2020-12-09 05:44

    Use ncurses to extract the sequences for the arrow key capabilities and then look for them when you read stdin. It's probably easier to use something like libedit or readline instead, and let that deal with the keyhandling.

提交回复
热议问题