📄 puts.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) puts.n 1.11 96/08/26 13:00:09'\" .so man.macros.TH puts n 7.5 Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEputs \- Write to a channel.SH SYNOPSIS\fBputs \fR?\fB\-nonewline\fR? ?\fIchannelId\fR? \fIstring\fR.BE.SH DESCRIPTION.PPWrites the characters given by \fIstring\fR to the channel givenby \fIchannelId\fR.\fIChannelId\fR must be a channel identifier such as returned from aprevious invocation of \fBopen\fR or \fBsocket\fR. It must have been openedfor output. If no \fIchannelId\fR is specified then it defaults to\fBstdout\fR. \fBPuts\fR normally outputs a newline character after\fIstring\fR, but this feature may be suppressed by specifying the\fB\-nonewline\fR switch..PPNewline characters in the output are translated by \fBputs\fR toplatform-specific end-of-line sequences according to the currentvalue of the \fB\-translation\fR option for the channel (for example,on PCs newlines are normally replaced with carriage-return-linefeedsequences; on Macintoshes newlines are normally replaced withcarriage-returns).See the \fBfconfigure\fR manual entry for a discussion of end-of-linetranslations..PPTcl buffers output internally, so characters written with \fBputs\fRmay not appear immediately on the output file or device; Tcl willnormally delay output until the buffer is full or the channel isclosed.You can force output to appear immediately with the \fBflush\fRcommand..PPWhen the output buffer fills up, the \fBputs\fR command will normallyblock until all the buffered data has been accepted for output by theoperating system.If \fIchannelId\fR is in nonblocking mode then the \fBputs\fR commandwill not block even if the operating system cannot accept the data.Instead, Tcl continues to buffer the data and writes it in thebackground as fast as the underlying file or device can accept it.The application must use the Tcl event loop for nonblocking outputto work; otherwise Tcl never finds out that the file or device isready for more output data.It is possible for an arbitrarily large amount of data to bebuffered for a channel in nonblocking mode, which could consume alarge amount of memory.To avoid wasting memory, nonblocking I/O should normallybe used in an event-driven fashion with the \fBfileevent\fR command(don't invoke \fBputs\fR unless you have recently been notifiedvia a file event that the channel is ready for more output data)..SH "SEE ALSO"fileevent(n).SH KEYWORDSchannel, newline, output, write
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -