select function

Jonathan I. Kamens jik at athena.mit.edu
Thu Mar 21 20:34:10 AEST 1991


In article <27E85B3B.14962 at ics.uci.edu>, djpadz at bonnie.ics.uci.edu (David Jay Padzensky) writes:
|> I'm writing a program that needs to use the select function to poll
|> for TTY input.  All I need for it to do is, given a timeout value (in
|> milliseconds), return a boolean value as to whether or not a key was
|> pressed in that time.  However, I'm having no luck with the thing.
|> Could somebody help me out?

  You have not given us enough information to help you.  If you have select()
on your system, then it *is* possible to use it as you have described; this is
discussed in question 7 on the Frequently Asked Questions posting in
comp.unix.questions, with additional relevant information in question 5.

  If what you're trying to do isn't working, then you have to tell us
*exactly* what you're trying to do in order for us to be able to help you
figure out *why* it isn't working.  Therefore, I suggest you post a short
sample of code that exhibits the problem you are having, and we'll try to help.

  It's possible that the reason things aren't working for you is that you
aren't enabling cbreak mode on the terminal, which means that the input from
the user is line-buffered (so that the user can backspace and such).  Like I
said, this is discussed in the FAQ posting.  If it has expired from
comp.unix.questions at your site, you can get it:

1. Via anonymous ftp from pit-manager.mit.edu (18.72.1.58), in the
   file

   /pub/usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting]

2. Via mail archive server.  Send mail to mail-server at pit-manager.mit.edu
   with a subject of

   send usenet/comp.unix.questions/Frequently_Asked_Questions_about_Unix_-_with_Answers_[Monthly_posting]

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik at Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710



More information about the Comp.unix.programmer mailing list