ed! - Ncurses Tutorial (Introduction), Part 3


Links
Home
Ncurses Tutorial - 1
Ncurses Tutorial - 2
Ncurses Tutorial - 3
Design Procedure
Feedback

Support writeKA


Web writeka.com

writeKA Language Tools

Valid XHTML 1.0 Strict
Valid CSS

Data last updated on 24-Mar-2002.
Standardised html and moved to new domain on 25-Feb-2006.

Previous      Ncurses-Site-List

Example Code
#include <stdio.h>
#include <ncurses.h>

void main()
{
        WINDOW *vin;
        initscr();
        start_color();
        init_pair(1,COLOR_YELLOW,COLOR_BLUE);
        init_pair(2,COLOR_BLUE,COLOR_YELLOW);
        init_pair(3,COLOR_BLUE,COLOR_WHITE); 
        vin=newwin(12,40,13,0);
        wmove(vin,0,5);
        wprintw(vin,"Hello, World.");
        wbkgd(vin,COLOR_PAIR(1));
        wrefresh(vin);
        getch();
        delwin(vin);
        endwin();
}

Save the file as hello.c, and execute the following at the command prompt.
$) cc hello.c -lncurses -o hello
$) ./hello

The following output can be expected.

Sample output

Previous