Xref: news-dnh.mv.net comp.os.msdos.djgpp:1838 Path: news-dnh.mv.net!mv!news.sprintlink.net!tank.news.pipex.net!pipex!howland.reston.ans.net!swrinde!elroy.jpl.nasa.gov!news.larc.nasa.gov!usenet From: t DOT s DOT abbott AT larc DOT nasa DOT gov (Terence Abbott) Newsgroups: comp.os.msdos.djgpp Subject: Re: kbhit with Unix/Linux Date: 30 Aug 1995 21:03:52 GMT Organization: NASA -Langley Research Center Lines: 31 References: Nntp-Posting-Host: tsabbo.larc.nasa.gov To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp In article , brendan AT rdt DOT monash DOT edu DOT au says... > > >I have been using DJGPP2 quite happily in my DOS (spew) enviroment. Now I >want to be able to develop under unix/linux. I've tried to run some simple >test programs that involve kbhit in a while loop. This is obviously fine in >DOS but linux doesn't have kbhit. What I need to do is read the current count >of characters/keypresses stored in the keyboard buffer (stdin???). > >I've tried feof(stdin) but the terminal streams don't seem to have an EOF >indicator. I have also tried getchar() with setvbuf(stdin, NULL, _IONBF, 0) >for unbufferd stream. No luck. > >Anybody have any suggestions. Is there something more portable that kbhit() >that I can use on both OS platforms. > >Brendan Simon >brendan AT rdt DOT monash DOT edu DOT au > Please look in this months Linux Journel. This exact topic is covered in an article.