C I/O Question
Kenneth Ng
ken at argus.UUCP
Mon Aug 4 22:37:07 AEST 1986
In article <503 at hadron.UUCP>, jsdy at hadron.UUCP (Joseph S. D. Yao) writes:
> In article <1222 at inuxc.UUCP> lar at inuxc.UUCP (L Reid) writes:
> >Is there a way to input a character from stdin without requiring
> >the user to terminate it with a <CR>.
>
> 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 at seismo.{CSS.GOV,ARPA,UUCP}
> jsdy at 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 at bellcore.uucp ***
bitnet(prefered) ken at njitcccc.bitnet or ken at 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"
More information about the Comp.lang.c
mailing list