[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to switch off line buffering in stdin?



On Wed, Jul 21, 1999 at 01:24:06PM +0200, E.L. Meijer Eric" wrote:
> > 
> > Hi All!
> > 
> > I'm writing an application, which implements some terminal functionalities.
> > I'd like to receive every keystroke, just after the key is pressed
> > (like with vga_getkey(), but in text mode).
> > The standard "fgetc(stdin)" receives the char only after the whole line is
> > entered. The "setvbuf(stdin,NULL,_IONBF,0);" doesn't help at all.
> > How to implement it? Probably I should use "ioctls" to change the console's
> > behaviour. Where should I look for the information?
> 
> You will want to use the curses library: man ncurses (yes that has an
> `n' in front).  To compile programs with ncurses, you need the ncurses
> development package, libncurses4-dev.
> 
Thank for all the answers!
I've solved the problem by calling:
  system("stty -echo -icanon");
at the begining of my application, and:
  system("stty echo icanon");
at the end.
-- 
			Wojciech Zabolotny
			wzab@ise.pw.edu.pl

http://www.debian.org  Use Linux - save your data and time


Reply to: