Tcl Source Code

Artifact [567d017cf0]
Login

Artifact 567d017cf065a428dd7f1fbf3b0b6f91554dd010:

Attachment "fileevent.diff" to ticket [465279ffff] added by davidw 2001-09-26 23:31:47.
Index: fileevent.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/fileevent.n,v
retrieving revision 1.3
diff -u -r1.3 fileevent.n
--- fileevent.n	2000/09/07 14:27:47	1.3
+++ fileevent.n	2001/09/26 16:29:53
@@ -96,6 +96,21 @@
 an error;  this is done in order to prevent infinite loops due to
 buggy handlers.
 
+.SH EXAMPLE
+.PP
+.CS
+\fBproc GetData { chan } {
+    if { ! [ eof $chan ] } {
+        puts [ gets $chan ]
+    }
+}
+
+fileevent $chan readable [list GetData $chan]
+\fR
+.CE
+This calls GetData with the channel as an argument whenever $chan
+becomes readable.
+
 .SH CREDITS
 .PP
 \fBfileevent\fR is based on the \fBaddinput\fR command created