Linux mint, XTerm
#include <cstdlib>
#include <ncurses.h>
#include <iosfwd>
using namespace std;
WINDOW* create_win(int height, int width, int beginy, int beginx, short color = 1, char* title = nullptr);
int main(int argc, char** argv) {
int height, width;
int ch;
WINDOW* input;
WINDOW* ami;
WINDOW* hdb3;
char line[width];
initscr();
cbreak();
curs_set(1);
keypad(stdscr, TRUE);
getmaxyx(stdscr, height, width);
start_color();
refresh();
init_pair(1, COLOR_BLACK, COLOR_WHITE);
init_pair(2, COLOR_MAGENTA, COLOR_YELLOW);
{//initialize windows
int ih = 3;
int ah = (height-3)/2;
int hh = (height-3)/2;
input = create_win(ih,width,0,0);
ami = create_win(ah,width,ih,0,2,"AMI");
hdb3 = create_win(hh,width,ih+ah,0,2,"HDB3");
}
ch= getch();//Проблема тут
while (ch!=27) { //Если убрать эти 4 строки ch = getch() и цикл ошибки нет
getstr(line);
}
//Create charts
endwin();
return 0;
}
WINDOW* create_win(int height, int width, int beginy, int beginx, short color, char* title) {
WINDOW* local;
local = newwin(height, width, beginy, beginx);
wbkgd(local, COLOR_PAIR(color));
wclear(local);
box(local, 0, 0);
wattron(local, A_REVERSE);
mvwaddstr(local, 0, 1, title);
wrefresh(local);
return local;
}