Curses question

Michael Hart hart at blackjack.dt.navy.mil
Tue Nov 20 23:44:23 AEST 1990


I've been trying out curses on an SGI Personal Iris.  The problem
I can't figure out is; when I quit the program, the screen doesn't
get cleared.  I get :
=====================================================
29
<blackjack \ hart >%(cursor here)
Hello, World!  Using Curses!!
30
Hello, World!  Using Curses!!
31
Hello, World!  Using Curses!!
32
Hello, World!  Using Curses!!
33
Hello, World!  Using Curses!!
34
Hello, World!  Using Curses!!
35
(etc.....)
======================================================

The prog is supposed to print Hello, World!  Using Curses!!, then
a repetition count on the next line.  (Needed the rep count, because
the PI was so fast, I couldn't tell if the thing running or not!).

Anyway, the prog quits with a ctl-C, and is supposed to clear the
screen.  I've tried werase(stdscr), wclear(stdscr), and with & without
a wrefresh(stdscr).  Am I being brain-dead, or is something funky
with curses on SGI?

=================prog below====================

/**************************************************
	Author:		Michael G. Hart
	Program Name:	cur1.c
	Date:			19 November 90
	Purpose:		test out curses functions
	Compile:		cc cur1.c -lc_s -lcurses -o cur1
***************************************************/

#include <curses.h>

/**************************************************

	main function here

***************************************************/

main()
{
	char *theStr = "Hello, World!  Using Curses!!\n";
	chtype theInput;
	int repCtr = 0;

/*	some curses initialization items first 
	init the curses code
	call character mode for input (cbreak)
	set noecho
	set to clear input buffer on an interrupt intrflus
*/
	initscr();
	cbreak();
	noecho();
	intrflush();
	nodelay(stdscr,TRUE);
	scrollok(stdscr,TRUE);

	theInput = wgetch(stdscr);
	while ( theInput != KEY_END) {
		addstr(theStr);
		repCtr++;
		wprintw(stdscr,"%d \n",repCtr);
		theInput = wgetch(stdscr);
	}
	wclear(stdscr);
	wrefresh(stdscr);
	endwin();
}
=================end prog======================

thanx!!!

--
-------------------------------------------------------------------------------
Michael G. Hart   hart at blackjack.dt.navy.mil /  mhart at oasys.dt.navy.mil
	I don't know what I want to be when I grow up!
DISCLAIMER: the usual!



More information about the Comp.lang.c mailing list