ultrix curses problem

chris rouch crouch at toadflax.axion.bt.co.uk
Fri Nov 4 23:19:43 AEST 1988


Reply-to: crouch at toadflax.axion.bt.co.uk (chris rouch)


I'm trying to use ultrix curses for some screen handling routines. What I
want to to do is interpret each character as it is typed (so that i can
respond to arrow keys etc.), while allowing typeahead.

The program looks something like this:

main(0
{
	/*initialisation*/
	crmode();
	.
	.
	.
	get_raw_char(str,size,echo_it);
	.
	.
	etc.
	nocrmode();
}
get_raw_char(str,size,echo_it)
char *str;
int size,echo_it;
{
int i;
	if (echo_it != TRUE)
		noecho();
	for (i=0;i<size;i++)
	{
		str[i] = getch();
	}
	echo();
}

The problem occurs if I try and type ahead more than a minimal amount (1 or
2 characters) the program ignores what is typed.  Worse still it misses the
<esc> part of the arrow key sequence resulting in '[B' or similar being
returned.

I've tried replacing [no]crmode() with [no]raw(), but the effect is the
same.

Is there anyway of getting curses to accept typeahead? Or is there a better
way of getting single character input while using curses?

Any help would be greatly appreciated.

Please e-mail any suggestions to me and I'll post a summary, when (if) I get
something working.


		Chris Rouch

--------------------------------------------------------------------------
vax to vax (UUCP)       CRouch at axion.bt.co.uk (...!ukc!btnix!crouch)
desk to desk            RT3124, 310 SSTF,
			British Telecom Research Laboratories,
			Martlesham Heath, IPSWICH, IP5 7RE, UK.
voice to voice          +44 473 646093

	"If you can't think once then don't think twice"
--------------------------------------------------------------------------



More information about the Comp.unix.ultrix mailing list