PersianGulf
PersianGulf

Reputation: 2935

ncurses disabled showing cursur in bash

I wrote a program that i used ncurses library, i used, keys menu windows and other its facilities. I run my program without any error. After quit program, i can't see any input data (certainly same you run passwd command and wanna input new password), for example if you run ls, i can see output of ls(list of current dir) , but i can't see ls word. How i solve this problem? piece of my code:

    WINDOW *menu_win,*qmenu_win,*amenu_win,*smenu_win;
char *query;
char *fields;

WriteFile *writePtr = new WriteFile();
ReadFile *readPtr = new ReadFile();

int highlight = 1;
int choice = 0;
int c;

initscr();
clear();
noecho();
cbreak();   /* Line buffering disabled. pass on everything */
startx = (80 - WIDTH) / 2;
starty = (24 - HEIGHT) / 2;

menu_win = newwin(HEIGHT, WIDTH, starty, startx);
keypad(menu_win, TRUE);
mvprintw(0, 0, "Use arrow keys to go up and down, Press enter to select a choice");
refresh();
print_menu(menu_win, highlight);
while (true)

Upvotes: 1

Views: 192

Answers (2)

Craig
Craig

Reputation: 4840

Make sure your program calls endwin() before exiting. Otherwise, the state of the terminal may not be restored.

Upvotes: 1

kfmfe04
kfmfe04

Reputation: 15327

When this happens, type reset at your prompt.

Also be aware that problems may be due to your terminal program itself. If it does not properly emulate the terminal it claims to emulate, you will run into problems.

Or it could be a bug with your program: maybe you need to replace noecho with echo?

Upvotes: 0

Related Questions