Detecting arrow keys input in C++ using curses on a unix platform is not working after calling a system command

StackOverflow https://stackoverflow.com/questions/7598126

  •  05-02-2021
  •  | 
  •  

Domanda

I have an application in which the user inputs data and needs to be able to move around the screen using the arrow keys. now I've used the curses library but I am having a problem detecting the arrows after calling a system command which is

system("more filename);

I've been able to detect them before calling this command. but afterwards, even after trying to turn the keypad on again using

keypad(scrn, TRUE);

it's not working.

any suggestions? thank you:)

È stato utile?

Soluzione

Try the advice here: http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/misc.html#TEMPLEAVE

Some times you may want to get back to cooked mode (normal line buffering mode) temporarily. In such a case you will first need to save the tty modes with a call to def_prog_mode() and then call endwin() to end the curses mode. This will leave you in the original tty mode. To get back to curses once you are done, call reset_prog_mode() . This function returns the tty to the state stored by def_prog_mode(). Then do refresh(), and you are back to the curses mode.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top