[comp.unix.questions] Thanks, guys...

pepper@dasys1.UUCP (Angelique Wahlstedt) (02/20/88)

Last week, I'd asked for help on how to code a timed read (from the
keyboard) in C on BSD 4.3, and ever since, I've gotten quite a handful
of replies. So, I want to thank all the guys for the help, some of them
that I didnt get to reply to in email.

In case anyone's curious, the best solution that I've found (after some
experimenting) is:

1.) turn off echoing (for a cleaner result) and go into cbreak mode.
2.) do a good ole select (). if the user hasnt typed in anything by then,
    the program goes ahead and does something else.
3.) turn the echoing back on and get out of cbreak mode.
4.) do a gets(), scanf() or whatever your favorite input function is,
    and let the user finish typing.

This may not be elegant, but it works just the way I wanted it to.

-- 
Angeli "Ms. Pepper" Wahlstedt

INTERNET: wahlsted@handel.colostate.edu    UUCP: ...!dasys1!pepper
          ms-pepper@cup.portal.com               ...!hao!handel!wahlsted