Getkey type function

Eyal Lebedinsky eyal at echo.canberra.edu.au
Mon Oct 8 23:17:19 AEST 1990


In article <24751 at uflorida.cis.ufl.EDU> pm0 at beach.cis.ufl.edu () writes:
>How can one just scan the keyboard for 1 and only 1 character?  I need a
>function similar to the getkey or $inkey function in basic.
>
>I do something like this:
>
>char ch
>
>while ((ch = getchar()) != 'q') {
>   printf("Char = %c %d");
>   do_whatever();
>}
>
>This evaluates the character I input and also the return character because
>Char = 10 is printed out after the inputted char is printed out.
>
>Is there any easy way to get it to scan for 1 character only without using
>special libraries like curses.h to achieve this?
>
On Unix, set the tty to raw mode. In msdos use getch/getche to do raw read.
>Thanks in advance,
>
>Pat (pm0 at beach.cis.ufl.edu)


-- 
Regards
	Eyal



More information about the Comp.lang.c mailing list