Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!caip!andromeda!argus!ken From: ken@argus.UUCP (Kenneth Ng) Newsgroups: net.lang.c,net.unix Subject: Re: C I/O Question Message-ID: <423@argus.UUCP> Date: Mon, 4-Aug-86 08:37:07 EDT Article-I.D.: argus.423 Posted: Mon Aug 4 08:37:07 1986 Date-Received: Mon, 4-Aug-86 21:09:45 EDT References: <1222@inuxc.UUCP> <503@hadron.UUCP> Distribution: net Organization: NJ Inst of Tech., Newark NJ Lines: 40 Xref: mnetor net.lang.c:5550 net.unix:5102 In article <503@hadron.UUCP>, jsdy@hadron.UUCP (Joseph S. D. Yao) writes: > In article <1222@inuxc.UUCP> lar@inuxc.UUCP (L Reid) writes: > >Is there a way to input a character from stdin without requiring > >the user to terminate it with a . > > Several ways. All involve doing an stty() or an ioctl() > call (depending on which version of Unix you have, or which > you feel more comfortable with -- starting from scratch, use > ioctl() if you have it). > The simplest and most general is to go into 'raw' mode. If > you are ceertain you'll never use a pre-V7 machine, 'cbreak' > mode might be better, depending on your intentions. > If you have System V, you can also set a minimum number of > chars before input returns, and/or a timeout. I've had a problem using this on an AT&T 3b5 running Syst 5R2. It seems that if you set the min character and timeout value, the timeout does NOT occur until the process receives at least ONE character. The only way I've been able to get this to work is to save the present alarm value, set an alarm for the timeout I wanted (10 seconds), and test to see if the alarm blasted the read out. > > Joe Yao hadron!jsdy@seismo.{CSS.GOV,ARPA,UUCP} > jsdy@hadron.COM (not yet domainised) -- Kenneth Ng: Post office: NJIT - CCCC, Newark New Jersey 07102 uucp(for a while) ihnp4!allegra!bellcore!argus!ken !psuvax1!cmcl2!ciap!andromeda!argus!ken *** WARNING: NOT ken@bellcore.uucp *** bitnet(prefered) ken@njitcccc.bitnet or ken@orion.bitnet Spock: "Captain, you are an excellent Starship Captain, but as a taxi driver, you leave much to be desired." Kirk: "What do you mean, 'if both survive' ?" T'Pow: "This combat is to the death"