diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/fileevent.n | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/doc/fileevent.n b/doc/fileevent.n index 037d361..8e82564 100644 --- a/doc/fileevent.n +++ b/doc/fileevent.n @@ -5,7 +5,7 @@ '\" See the file "license.terms" for information on usage and redistribution '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. '\" -'\" RCS: @(#) $Id: fileevent.n,v 1.4 2001/09/14 19:20:40 andreas_kupries Exp $ +'\" RCS: @(#) $Id: fileevent.n,v 1.5 2001/09/27 05:50:56 andreas_kupries Exp $ '\" .so man.macros .TH fileevent n 7.5 Tcl "Tcl Built-In Commands" @@ -101,6 +101,21 @@ In addition, the file event handler is deleted if it ever returns an error; this is done in order to prevent infinite loops due to buggy handlers. +.SH EXAMPLE +.PP +.CS + proc GetData {chan} { + if {![eof $chan]} { + puts [gets $chan] + } + } + + fileevent $chan readable [list GetData $chan] + +.CE +In this setup \fBGetData\fR will be called with the channel as an +argument whenever $chan becomes readable. + .SH CREDITS .PP \fBfileevent\fR is based on the \fBaddinput\fR command created |