Xref: news-dnh.mv.net comp.os.msdos.djgpp:2808 Path: news-dnh.mv.net!mv!news.sprintlink.net!newsfeed.internetmci.com!in1.uu.net!newsfeed.ACO.net!fstgal00.tu-graz.ac.at!not-for-mail From: kremser AT sbox DOT tu-graz DOT ac DOT at (Herbert Kremser) Newsgroups: comp.os.msdos.djgpp Subject: need something better than kbhit() Date: 25 Oct 1995 01:49:12 GMT Organization: Graz University of Technology, Austria Lines: 44 Nntp-Posting-Host: freelove.tu-graz.ac.at To: djgpp AT sun DOT soe DOT clarkson DOT edu Dj-Gateway: from newsgroup comp.os.msdos.djgpp 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. What i need is something like: for (;;) { if (something_in_input) { read(0, buf, 256); /* queue that input */ } /* do something here */ } or maybe something similar to: 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."