Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!bloom-picayune.mit.edu!athena.mit.edu!jik From: jik@athena.mit.edu (Jonathan I. Kamens) Newsgroups: comp.unix.programmer Subject: Re: select function Message-ID: <1991Mar21.103410.12477@athena.mit.edu> Date: 21 Mar 91 10:34:10 GMT References: <27E85B3B.14962@ics.uci.edu> Sender: news@athena.mit.edu (News system) Organization: Massachusetts Institute of Technology Lines: 38 In article <27E85B3B.14962@ics.uci.edu>, djpadz@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@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@Athena.MIT.EDU Allston, MA 02134 Office: 617-253-8085 Home: 617-782-0710