diff options
author | andreas_kupries <akupries@shaw.ca> | 2001-09-27 05:50:56 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2001-09-27 05:50:56 (GMT) |
commit | 8005a1ea0359cc32b78d70f77f91fbc6e73e58b5 (patch) | |
tree | b2735d686a38fb6d792949148e4ee91cc365efa0 /doc | |
parent | b60e127643bd0ad00cf457b77b1de6e0977f6b2c (diff) | |
download | tcl-8005a1ea0359cc32b78d70f77f91fbc6e73e58b5.zip tcl-8005a1ea0359cc32b78d70f77f91fbc6e73e58b5.tar.gz tcl-8005a1ea0359cc32b78d70f77f91fbc6e73e58b5.tar.bz2 |
* doc/fileevent.n: Accepted [Patch #465279] adding an example to
the fileevent manpage. Minor modifications to get a better
formatting. Report and patch by David N. Welton
<davidw@users.sourceforge.net>.
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 |