上面引用的ncurses howto可能会有所帮助。这是一个示例,说明如何像conio示例一样使用ncurses:
#include <ncurses.h>intmain(){ initscr(); cbreak(); noecho(); scrollok(stdscr, TRUE); nodelay(stdscr, TRUE); while (true) { if (getch() == 'g') { printw("You pressed Gn"); } napms(500); printw("Runningn"); }}请注意,对于ncurses,
iostream不使用标头。这是因为将stdio与ncurses混合会产生意外结果。
顺便说一下,ncurses定义
TRUE和
FALSE。正确配置的ncurses将为ncurses使用与
bool用于配置ncurses的C
++编译器相同的数据类型。



