Xref: utzoo comp.sys.ibm.pc.hardware:8870 comp.sys.ibm.pc.programmer:2709 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!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.hardware,comp.sys.ibm.pc.programmer Subject: How to implement an I/O Timeout Message-ID: <1991May21.164600.10474@spool.cs.wisc.edu> Date: 21 May 91 16:46:00 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. Please email--I will post summary. ttl@cs.wisc.edu