RosettaCodeData/Task/Keyboard-input-Keypress-check/Tcl/keyboard-input-keypress-check-2.tcl
2023-07-01 13:44:08 -04:00

10 lines
204 B
Tcl

fileevent stdin readable GetChar
proc GetChar {} {
set ch [read stdin 1]
if {[eof stdin]} {
exit
}
# Do something with $ch here
}
vwait forever; # run the event loop if necessary