Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Mon, 16 Jul 2001 17:16:43 +0200 From: Kurt Roeckx To: cygwin AT cygwin DOT com Subject: Setting stdin to non-blocking io Message-ID: <20010716171643.A6752@ping.be> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i I'm having a problem setting stdin to non-blocking io. The read always seems to block. I've tried using both ioctl() and fcntl(). This program for example: #include #include #include int main(void) { int val; char buf[10]; val = 1; ioctl(0, FIONBIO, &val); read(0, buf, sizeof(buf)); return 0; } It should just return to the prompt directly without reading anything, but it waits for the user to hit enter. Doing this: val = fcntl(sock, F_GETFL, 0); fcntl(sock, F_SETFL, val|O_NONBLOCK); Does just the same. I'm doing this on win98 with cygwin 1.3.2. I assume I have to do something else to get it working properly, since other programs seem to be able to do it (like bash, vim, ...) Kurt -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/