www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/10/25/08:06:41

Date: Wed, 25 Oct 1995 13:51:03 +0300
From: "Alexander V. Lukyanov" <lav AT video DOT yars DOT free DOT net>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: need something better than kbhit()

> How can you determine if something is available at stdin?
> I rather need a nonblocking input function.
> 
> kbhit() doesn't work, since it checks the real keyboard, not the
> (buffered) stdin descriptor.

Is it possible to emulate the Unix 'poll' function in DOS?
Did anybody do it? Does anybody plan to write the function? 
I'm sure, it is very useful even for DOS.

>skipped...
> fcntl(0, F_SETFL, O_NDELAY);  /* make stdin nonblocking */
> for (;;)
>   {
>   r_read = read(0, buf, 256);
>   if (r_read < 0)
>     {
>     if (errno == EWOULDBLOCK)
>       /* thats ok */ ;
>     else
>       /* report that error */
>     }
>   /* do something here */
>   }
> 
> I have no idea how to achieve either of this approaches with djgpp,
> by reading the faq and documentation.
> So many thanks for leading a djgpp newbie on the right path.  :-)
> 
> Herbert
> 
> -- 
> Herbert Kremser                                      |  "On the Internet,
> kremser AT flinux DOT tu-graz DOT ac DOT at                         |   nobody knows
> kremser AT sbox DOT tu-graz DOT ac DOT at                           |   you're a dog." 

---
Alexander Lukyanov
lav AT video DOT yars DOT free DOT net

- Raw text -


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