www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/30/09:40:25

From: Brendan Simon <brendan AT rdt DOT monash DOT edu DOT au>
Date: Wed, 30 Aug 1995 20:10:58 +1000
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: kbhit with Unix/Linux

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019