Source Code File 12-03_scrollsub

12-03_scrollsub.c

#include <ncurses.h>

int main()
{
    WINDOW *sub;
    char text[] = "Scroll away! ";
    int x;
    
    initscr();
    
    sub = subwin(stdscr,10,30,6,24);
    scrollok(sub,TRUE);
    for(x=0;x<35;x++)
    {
        waddstr(sub,text);
        napms(50);
        wrefresh(sub);
    }
    getch();
    
    endwin();
    return(0);
}

Output Screenshot

Notes

* Text is output only to the subwindow, which is located near the center of the screen. Only that portion of the screen scrolls.