C prgram needed - read with timeout

02335%UWAV4.BITNET at wiscvm.ARPA 02335%UWAV4.BITNET at wiscvm.ARPA
Sat Aug 16 15:08:48 AEST 1986


Hi,

I have been working on an HP-9000 Unix machine trying to do a read that
does not wait for a RETURN.  One character is all I need, but there doesn;t
seem to be a C function to do this.  I've looked at the IOCTL stuff, but the
timeout doesn't work until after one character has been pressed.  I did
get something to work setting the O_NDELAY bit with FCNTL, but there is no
way to unset that bit so when I exit the program I get logged out since
UNIX timeouts and all other reads timeout as well.

I eventually wrote an interrupt handler using SIGNAL.  But I really
need to trap and return any character being pressed not just the DELETE key.

My main program is really in FORTRAN, but I'm pretty sure that I must
call a C routine to get the job done if it is possible.  I am really a
Vax FORTRAN programmer which has no problem polling the keypboard, so I
am a little amused that C doesn't seem to have this capability.

Any help would be greatly appreciated...  Please reply directly to me since
I do not get INFO-C mail.

Thanks in advance,
Tony Andrea
Sierra Geophysics, Inc.
Kirkland, Washington

BITNET:      02335 at UWAV4
ARPA/CSNET:  02335%uwav4.bitnet at wiscvm.arpa



More information about the Comp.lang.c mailing list