Source Code File 12-06_scrollreg

12-06_scrollreg.c

#include <ncurses.h>

int main()
{
    char text[] = "Scroll me! ";
    int x;

    initscr();

    bkgd('.');
    scrollok(stdscr,TRUE);
    setscrreg(3,LINES-3);

    for(x=0;x<200;x++)
    {
        addstr(text);
        napms(25);
        refresh();
    }
    getch();

    endwin();
    return(0);
}

Output Screenshot

Notes

* In the sample output above, only the center 18 lines of text scroll. That's the defined text region for the standard screen, as set in Line 12 by the setscrreg() function.