
#include <stdio.h>
#include <curses.h>

/*

listing 1  - sample curses application 

sample.c

*/

/* define window pointer */
WINDOW *win;

main()
{

	/* must be called before any curses command */
	initscr();

	/* get space for window at coordinates (y,x,begy,begx) */
	/* y is # of rows, x is # of columns */
	/* begy & begx are the positions on the screen */
	win = newwin(24,80,0,0);

	/* surround the window with characters provided */
	box (win, '|', '-');
	
	/* place the string in win at position y,x */
	mvwaddstr(win,2,2, "enter a character to erase window");

	/* this must be done to view changes on screen */
	/* otherwise changes are made only in memory */
	wrefresh(win);

	/* get a single character from the keyboard */
	wgetch(win);

	/* erase the window in memory */
	werase(win);

	/* necessary to complete the erase on screen */
	wrefresh(win);
	
	/* remove the window from memory */
	delwin(win);

	/* must be called to end a curses program */
	endwin();

}

