[comp.sys.ibm.pc] How to implement an I/O Timeout

ttl@aura.cs.wisc.edu (Tony Laundrie) (05/21/91)

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