⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fconfigure.n

📁 tcl是工具命令语言
💻 N
📖 第 1 页 / 共 2 页
字号:
'\" '\" Copyright (c) 1995-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.'\"'\" RCS: @(#) $Id: fconfigure.n,v 1.7 2002/07/01 18:24:39 jenglish Exp $'\".so man.macros.TH fconfigure n 8.3 Tcl "Tcl Built-In Commands".BS'\" Note:  do not modify the .SH NAME line immediately below!.SH NAMEfconfigure \- Set and get options on a channel.SH SYNOPSIS.nf\fBfconfigure \fIchannelId\fR\fBfconfigure \fIchannelId\fR \fIname\fR\fBfconfigure \fIchannelId\fR \fIname value \fR?\fIname value ...\fR?.fi.BE.SH DESCRIPTION.PPThe \fBfconfigure\fR command sets and retrieves options for channels..PP\fIChannelId\fR identifies the channel for which to set or query anoption and must refer to an open channel such as a Tcl standardchannel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR), the returnvalue from an invocation of \fBopen\fR or \fBsocket\fR, or the resultof a channel creation command provided by a Tcl extension..PPIf no \fIname\fR or \fIvalue\fR arguments are supplied, the commandreturns a list containing alternating option names and values for the channel.If \fIname\fR is supplied but no \fIvalue\fR then the command returnsthe current value of the given option.If one or more pairs of \fIname\fR and \fIvalue\fR are supplied, thecommand sets each of the named options to the corresponding \fIvalue\fR;in this case the return value is an empty string..PPThe options described below are supported for all channels. In addition,each channel type may add options that only it supports. See the manualentry for the command that creates each type of channels for the optionsthat that specific type of channel supports. For example, see the manualentry for the \fBsocket\fR command for its additional options..TP\fB\-blocking\fR \fIboolean\fRThe \fB\-blocking\fR option determines whether I/O operations on thechannel can cause the process to block indefinitely.The value of the option must be a proper boolean value.Channels are normally in blocking mode;  if a channel is placed intononblocking mode it will affect the operation of the \fBgets\fR,\fBread\fR, \fBputs\fR, \fBflush\fR, and \fBclose\fR commands;see the documentation for those commands for details.For nonblocking mode to work correctly, the application must beusing the Tcl event loop (e.g. by calling \fBTcl_DoOneEvent\fR orinvoking the \fBvwait\fR command)..TP\fB\-buffering\fR \fInewValue\fR.If \fInewValue\fR is \fBfull\fR then the I/O system will buffer outputuntil its internal buffer is full or until the \fBflush\fR command isinvoked. If \fInewValue\fR is \fBline\fR, then the I/O system willautomatically flush output for the channel whenever a newline characteris output. If \fInewValue\fR is \fBnone\fR, the I/O system will flushautomatically after every output operation.  The default is for\fB\-buffering\fR to be set to \fBfull\fR except for channels thatconnect to terminal-like devices; for these channels the initial settingis \fBline\fR.  Additionally, \fBstdin\fR and \fBstdout\fR areinitially set to \fBline\fR, and \fBstderr\fR is set to \fBnone\fR..TP\fB\-buffersize\fR \fInewSize\fR.\fINewvalue\fR must be an integer; its value is used to set the size ofbuffers, in bytes, subsequently allocated for this channel to store inputor output. \fINewvalue\fR must be between ten and one million, allowingbuffers of ten to one million bytes in size..TP\fB\-encoding\fR \fIname\fR.This option is used to specify the encoding of the channel, so that the datacan be converted to and from Unicode for use in Tcl.  For instance, inorder for Tcl to read characters from a Japanese file in \fBshiftjis\fRand properly process and display the contents, the encoding would be setto \fBshiftjis\fR.  Thereafter, when reading from the channel, the bytes inthe Japanese file would be converted to Unicode as they are read.Writing is also supported \- as Tcl strings are written to the channel theywill automatically be converted to the specified encoding on output..RS.PPIf a file contains pure binary data (for instance, a JPEG image), theencoding for the channel should be configured to be \fBbinary\fR.  Tclwill then assign no interpretation to the data in the file and simply read orwrite raw bytes.  The Tcl \fBbinary\fR command can be used to manipulate thisbyte-oriented data..PPThe default encoding for newly opened channels is the same platform- andlocale-dependent system encoding used for interfacing with the operatingsystem.  .RE.TP\fB\-eofchar\fR \fIchar\fR.TP\fB\-eofchar\fR \fB{\fIinChar outChar\fB}\fR.This option supports DOS file systems that use Control-z (\ex1a) as anend of file marker.  If \fIchar\fR is not an empty string, then thischaracter signals end-of-file when it is encountered during input.  Foroutput, the end-of-file character is output when the channel is closed.If \fIchar\fR is the empty string, then there is no special end of filecharacter marker.  For read-write channels, a two-element list specifiesthe end of file marker for input and output, respectively.  As aconvenience, when setting the end-of-file character for a read-writechannel you can specify a single value that will apply to both readingand writing.  When querying the end-of-file character of a read-writechannel, a two-element list will always be returned.  The default valuefor \fB\-eofchar\fR is the empty string in all cases except for filesunder Windows.  In that case the \fB\-eofchar\fR is Control-z (\ex1a) forreading and the empty string for writing..TP\fB\-translation\fR \fImode\fR.TP\fB\-translation\fR \fB{\fIinMode outMode\fB}\fR .In Tcl scripts the end of a line is always represented using a singlenewline character (\en).  However, in actual files and devices the end ofa line may be represented differently on different platforms, or even fordifferent devices on the same platform.  For example, under UNIX newlinesare used in files, whereas carriage-return-linefeed sequences arenormally used in network connections.  On input (i.e., with \fBgets\fPand \fBread\fP) the Tcl I/O system automatically translates the externalend-of-line representation into newline characters.  Upon output (i.e.,with \fBputs\fP), the I/O system translates newlines to the externalend-of-line representation.  The default translation mode, \fBauto\fP,handles all the common cases automatically, but the \fB\-translation\fRoption provides explicit control over the end of line translations..RS.PPThe value associated with \fB\-translation\fR is a single item forread-only and write-only channels.  The value is a two-element list forread-write channels; the read translation mode is the first element ofthe list, and the write translation mode is the second element.  As aconvenience, when setting the translation mode for a read-write channelyou can specify a single value that will apply to both reading andwriting.  When querying the translation mode of a read-write channel, atwo-element list will always be returned.  The following values arecurrently supported:.TP\fBauto\fR.As the input translation mode, \fBauto\fR treats any of newline(\fBlf\fP), carriage return (\fBcr\fP), or carriage return followed by anewline (\fBcrlf\fP) as the end of line representation.  The end of linerepresentation can even change from line-to-line, and all cases aretranslated to a newline.  As the output translation mode, \fBauto\fRchooses a platform specific representation; for sockets on all platformsTcl chooses \fBcrlf\fR, for all Unix flavors, it chooses \fBlf\fR, for theMacintosh platform it chooses \fBcr\fR and for the various flavors ofWindows it chooses \fBcrlf\fR.  The default setting for\fB\-translation\fR is \fBauto\fR for both input and output..TP\fBbinary\fR .No end-of-line translations are performed.  This is nearly identical to\fBlf\fP mode, except that in addition \fBbinary\fP mode also sets theend-of-file character to the empty string (which disables it) and sets theencoding to \fBbinary\fR (which disables encoding filtering).  See thedescription of \fB\-eofchar\fR and \fB\-encoding\fR for more information..TP\fBcr\fR.The end of a line in the underlying file or device is represented by asingle carriage return character.  As the input translation mode,\fBcr\fP mode converts carriage returns to newline characters.  As theoutput translation mode, \fBcr\fP mode translates newline characters tocarriage returns.  This mode is typically used on Macintosh platforms..TP\fBcrlf\fR.The end of a line in the underlying file or device is represented by acarriage return character followed by a linefeed character.  As the inputtranslation mode, \fBcrlf\fP mode converts carriage-return-linefeedsequences to newline characters.  As the output translation mode,\fBcrlf\fP mode translates newline characters to carriage-return-linefeedsequences.  This mode is typically used on Windows platforms and fornetwork connections..TP\fBlf\fR.The end of a line in the underlying file or device is represented by asingle newline (linefeed) character.  In this mode no translations occurduring either input or output.  This mode is typically used on UNIXplatforms..RE.PP.SH "STANDARD CHANNELS".PPThe Tcl standard channels (\fBstdin\fR, \fBstdout\fR, and \fBstderr\fR)can be configured through this command like every other channel openedby the Tcl library. Beyond the standard options described above theywill also support any special option according to their current type.If, for example, a Tcl application is started by the \fBinet\fRsuper-server common on Unix system its Tcl standard channels will besockets and thus support the socket options.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -