mhovan@gmuvax2.gmu.edu (Mike Hovan) (12/28/90)
I am attempting to read a character at a time from stdin using getch. Unfortunately, it buffers my input until enter is pressed. I tried unbuffering stdin using something like: setvbuf(stdin,NULL,_IONBF,0); but it doesn't seem to help. I don't want to use the conio functions because the input is going to be redirected using ctty. Does anybody have a fix? Does anybody know what I am talking about? Does anybody care? Does anybody really know what time it is? Mike -- |X|X|"Pay no mind to what they say, Michael Andrew Hovan III |X|X| |X| Doesn't matter anyway hey hey hey, mhovan@gmuvax2.gmu.edu |X| |X| Our lips are sealed." George Mason University |X| |X|X| --The Go-Go's Fairfax, Virginia, USA |X|X|
edwill@earth.lerc.nasa.gov (Glenn L. Williams) (01/04/91)
In article <3169@gmuvax2.gmu.edu>, mhovan@gmuvax2.gmu.edu (Mike Hovan) writes... >I am attempting to read a character at a time from stdin using getch. >Unfortunately, it buffers my input until enter is pressed. I tried >unbuffering stdin using something like: > > setvbuf(stdin,NULL,_IONBF,0); > >but it doesn't seem to help. I don't want to use the conio functions >because the input is going to be redirected using ctty. Does anybody >have a fix? Does anybody know what I am talking about? Does anybody >care? Does anybody really know what time it is? > > Mike > >-- > |X|X|"Pay no mind to what they say, Michael Andrew Hovan III |X|X| > |X| Doesn't matter anyway hey hey hey, mhovan@gmuvax2.gmu.edu |X| > |X| Our lips are sealed." George Mason University |X| > |X|X| --The Go-Go's Fairfax, Virginia, USA |X|X| I use DOS interrupts and go directly read the keyboard. There is at least one funny situation like that. I found that when you start a program with standard input redirected: dothis <withme you can't get back to the keyboard after the contents of <withme have been sucked in. However, the DOS interrupt method can then be used to look at the keyboard.