Source Code File 12-04_scroll
12-04_scroll.c
#include <ncurses.h>
int main()
{
int y;
initscr();
/* enable scrolling */
scrollok(stdscr,TRUE);
/* place junk on the screen */
for(y=0;y<LINES;y++)
mvprintw(y,0,"%2d",y);
refresh();
getch();
/* scroll up one line */
scroll(stdscr);
refresh();
getch();
endwin();
return 0;
}
Output Screenshot

Notes
* After you press enter, the lines of text (shown above) hop up one notch, and a blank line is added at the bottom of the screen.
Copyright © 1997-2025 by QPBC.
All rights reserved
