Source Code File 09-01_anotherwin

09-01_anotherwin.c

#include <ncurses.h>
   
int main()
{
    WINDOW *another;

    initscr();

    addstr("This is the standard screen\n");
    refresh();
    getch();

    /* create another window */
    another = newwin(0,0,0,0);
    if( another == NULL)
    {
        addstr("Unable to create window");
        refresh();
        getch();
    }
    else
    {
        waddstr(another,"This is another window");
        wrefresh(another);
        wgetch(another);
    }

    endwin();
    return(0);
}

Output Screenshot


(Click to update image.)

Notes

* It appears as if the text This is another window overwrites the original text, This is the standard screen. However, what you see is a new window, another.