gpt4 book ai didi

linux - ncurses 禁止在 bash 中显示光标

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:09:28 25 4
gpt4 key购买 nike

我写了一个程序,我使用了 ncurses 库,我使用了按键菜单窗口和它的其他功能。我运行我的程序没有任何错误。退出程序后,我看不到任何输入数据(肯定是你运行 passwd 命令并想输入新密码),例如,如果你运行 ls,我可以看到 ls 的输出(当前列表) dir) ,但我看不到 ls 字。我如何解决这个问题?我的一段代码:

    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)

最佳答案

确保您的程序在退出前调用了 endwin()。否则可能无法恢复终端状态。

关于linux - ncurses 禁止在 bash 中显示光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8553624/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com