Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!uwm.edu!uwvax!aura.cs.wisc.edu!ttl From: ttl@aura.cs.wisc.edu (Tony Laundrie) Newsgroups: comp.sys.ibm.pc Subject: How to implement an I/O Timeout Message-ID: <1991May21.163107.10216@spool.cs.wisc.edu> Date: 21 May 91 16:31:07 GMT Sender: news@spool.cs.wisc.edu (The News) Distribution: usa Organization: U of Wisconsin CS Dept Lines: 13 I am doing some low-level I/O, and if the cables aren't all connected, then an inp() statement will hang forever. How do I set up a timeout in Turbo C or Microsoft C? I want to say something like: settimeout (2, timeout_error); /* in two seconds, call timeout_error() */ x = inp (); /* attempt input */ settimeout (0); /* cancel the timeout, 'cuz we succeeded */ Thanks for the help. ttl@cs.wisc.edu