top*_*erg 4 c linux scrollbars ncurses
我最近被介绍过ncurses用于异步键盘按键监听,并且与它相处得很好.我面临的一个问题是你只能在可见屏幕上显示文字,没有滚动条.我想知道它是否可以继续使用,ncurses因为它是如此可爱,但让程序仍然保持滚动条而不是到达最后一行并留在那里.
Duc*_*uck 11
滚动().你必须先设置scrollok(win,TRUE).实际上,如果你只是想像普通终端一样喷出数据,你只需要自己设置scrollok().
#include <ncurses.h>
int main(void)
{
int i = 0;
initscr();
scrollok(stdscr,TRUE);
while(1)
{
printw("%d - lots and lots of lines flowing down the terminal\n", i);
++i;
refresh();
}
endwin();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9198 次 |
| 最近记录: |