From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <96078609810691.tru64-unix-managers.marc@archive.invalid> From: Bob.Capps () pscmail ! ps ! net Date: Thu, 27 Mar 1997 18:36:00 +0000 To: tru64-unix-managers Subject: C prg: peeking in stdin before getchar or timeout alarm X-MARC-Message: https://marc.info/?l=tru64-unix-managers&m=96078609810691 We have a process which communicates to dialin terminals which is expecting things to behave in an orderly fashion: Connect, tell me what you want to do, are you done, goodbye. The trouble is, things don't always behave over various local phone lines. We constantly "hang" our process while it waits for more input from the dialin terminal. Does anyone have any code fragments to provide either of the following: 1) a way to "peek" into stdin before we call getchar to see if there is anything to get and timeout after a certain period of time. 2) a way to set up a timer so that if we don't get out of getchar before a certain period of time has elapsed, we exit out of the program. Thanks! Bob Capps bob.capps@ps.net