From nouser@nohost.nodomain Wed Aug 5 22:16:18 CDT 1998 Article: 89803 of comp.lang.tcl Path: uuneo.neosoft.com!ultraneo.neosoft.com!su-news-hub1.bbnplanet.com!news.bbnplanet.com!newsfeed.wli.net!peerfeed.ncal.verio.net!news.ncal.verio.com!not-for-mail From: nouser@nohost.nodomain (Thomas) Newsgroups: comp.lang.tcl Subject: Re: "proc keypressed" or "Getting a single key input" Date: 29 Jul 1998 22:59:03 -0700 Organization: home Lines: 32 Sender: nouser@nohost.nodomain Message-ID: References: <35BD03C9.7FB8A95A@nettestca.gn.com> <35BF47BC.B2F62886@nettestca.gn.com> NNTP-Posting-Host: shell1.aimnet.com In-reply-to: "Peter V. Morch"'s message of Wed, 29 Jul 1998 12:03:08 -0400 X-Newsreader: Gnus v5.1 X-No-Archive: yes X-No-Junk-Mail: yes (do not put me on any mailing lists or send junk mail) Xref: uuneo.neosoft.com comp.lang.tcl:89803 In article <35BF47BC.B2F62886@nettestca.gn.com> "Peter V. Morch" writes: However, this *does* work: > fconfigure stdin -blocking 0 > fileevent stdin readable { > puts XX[read stdin] > } Every time I hit a key, it prints out XX. This leads me to believe, it is not an (s)tty problem. I'm running on Solaris-x86 2.5.1 I don't know how you are running it, but when I run your code with wish8.0 under Linux, it behaves exactly the way it should: a line gets buffered, and then it gets read as a whole. Any other behavior would be incorrect and indicates that you have some kind of problem in your environment. Here is code that works with both tclsh8.0 and wish8.0: set old [exec stty -g <@ stdin] exec stty raw <@ stdin fconfigure stdin -blocking 0 fileevent stdin readable { set c [read stdin] if {$c == "q"} {set done 1} puts "($c)\r" } vwait done exec stty $old <@ stdin puts stderr "seeya" Thomas.