getch returns 410 when I resize terminal. Why does the getch interpret the resize as input? What's the 410? Is it a special symbol?
Code:
#include <curses.h>
int main() {
initscr(); cbreak(); noecho();
int x = getch();
printw("%d", x);
getch();
endwin();
return 0;
}
But when I use timeout I get ERR (i.e -1). Why does resizing when using the timeout lead to an error?
Code:
#include <curses.h>
int main() {
initscr(); cbreak(); noecho(); timeout(10000);
int x = getch();
printw("%d", x);
getch();
endwin();
return 0;
}
/* curses.h */
#define KEY_RESIZE 0632 /* Terminal resize event */
410 = 0632 (octal).
As for your second question, that doesn't happen when I test on my machine. Are you perhaps running an old version of ncurses? There have been bugs around this. https://lists.gnu.org/archive/html/bug-ncurses/2002-01/msg00003.html