Path: utzoo!attcan!uunet!munnari.oz.au!csc.anu.oz.au!csc3.anu.oz.au!csc.canberra.edu.au!news From: eyal@echo.canberra.edu.au (Eyal Lebedinsky) Newsgroups: comp.lang.c Subject: Re: Getkey type function Message-ID: <1990Oct8.131719.6173@csc.canberra.edu.au> Date: 8 Oct 90 13:17:19 GMT References: <24751@uflorida.cis.ufl.EDU> Sender: news@csc.canberra.edu.au Organization: Info Sci & Eng, University of Canberra Lines: 28 In article <24751@uflorida.cis.ufl.EDU> pm0@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@beach.cis.ufl.edu) -- Regards Eyal