Need Help: 1-char input in C

Dubman mort at ihuxn.UUCP
Thu Dec 22 12:56:27 AEST 1983


I am writing a program in C that requires a menu with four choices,
I, D, L, and Q for Insert, Delete, List and Quit.

I want to have it so that the program can key an ASCII value for the key
from the VT100 terminal without having to have the user type RETURN.

I tried using getchar() but inputs an entire line up to the RETURN, returns
the first letter, and shoves the rest in a buffer that is emptied the next
time getchar() is called.

I just read that CP/M's version of C returns the value of the key as soon
as the key is typed, but UNIX C (which I am using) waits for a newline.
Yet, I know that many C utilities do accept a key as soon as I type it.

Any ideas?

						Thanks in Advance,

-- 

Jonathan Dubman - care of:

		Mort Dubman		AT&T Bell Laboratories
		ihnp4!ihuxn!mort	Naperville, IL.



More information about the Comp.lang.c mailing list