summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2004-04-30 15:28:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2004-04-30 15:28:55 (GMT)
commit655ca7dde8ded6685ce09cb17186766b7f0352b5 (patch)
tree87d3f41ece2b147736640d0bc0ace117dc69f3b4
parentdd854175d4c77b6a65cd86542210289bd47bb4c0 (diff)
downloadtcl-655ca7dde8ded6685ce09cb17186766b7f0352b5.zip
tcl-655ca7dde8ded6685ce09cb17186766b7f0352b5.tar.gz
tcl-655ca7dde8ded6685ce09cb17186766b7f0352b5.tar.bz2
More examples
-rw-r--r--ChangeLog4
-rw-r--r--doc/puts.n27
2 files changed, 30 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 87e947a..480e48a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2004-04-30 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+
+ * doc/puts.n: Added a few examples.
+
2004-04-29 Don Porter <dgp@users.sourceforge.net>
* tests/execute.test (execute-8.2): Avoid crashes when there
diff --git a/doc/puts.n b/doc/puts.n
index 0eea91b..f12e48f 100644
--- a/doc/puts.n
+++ b/doc/puts.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: puts.n,v 1.6 2004/03/17 18:14:12 das Exp $
+'\" RCS: @(#) $Id: puts.n,v 1.7 2004/04/30 15:29:03 dkf Exp $
'\"
.so man.macros
.TH puts n 7.5 Tcl "Tcl Built-In Commands"
@@ -67,6 +67,31 @@ To avoid wasting memory, nonblocking I/O should normally
be used in an event-driven fashion with the \fBfileevent\fR command
(don't invoke \fBputs\fR unless you have recently been notified
via a file event that the channel is ready for more output data).
+.SH EXAMPLES
+Write a short message to the console (or wherever \fBstdout\fR is
+directed):
+.CS
+puts "Hello, World!"
+.CE
+
+Print a message in several parts:
+.CS
+puts -nonewline "Hello, "
+puts "World!"
+.CE
+
+Print a message to the standard error channel:
+.CS
+puts stderr "Hello, World!"
+.CE
+
+Append a log message to a file:
+.CS
+set chan [open my.log a]
+set timestamp [clock format [clock seconds]]
+puts $chan "$timestamp - Hello, World!"
+close $chan
+.CE
.SH "SEE ALSO"
file(n), fileevent(n), Tcl_StandardChannels(3)