2011-12-18 34 views
1

我寫了一個程序,我使用了ncurses庫,我使用了,鍵菜單窗口和其他設施。 我運行我的程序沒有任何錯誤。 退出程序後,我看不到任何輸入數據(肯定與你運行passwd命令相同,並想輸入新密碼),例如,如果運行ls,我可以看到ls(當前目錄列表)的輸出,但我看不到ls字。 我如何解決這個問題? 一塊我的代碼:在提示符下ncurses禁止在bash中顯示cursur

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) 

回答

0

發生這種情況時,類型reset

另外請注意,問題可能是由於您的終端程序本身。如果它沒有正確模擬它聲稱效仿的終端,則會遇到問題。

或者它可能是你的程序的錯誤:也許你需要用echo替換noecho

1

確保程序在退出之前調用endwin()。否則,終端的狀態可能無法恢復。

+0

哦,謝謝你我解決了你的建議,我把endwin()函數從我的程序中退出。 – PersianGulf 2011-12-20 18:41:05