📄 openfilechnl.3
字号:
'\"'\" Copyright (c) 1996-1997 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: OpenFileChnl.3,v 1.20 2002/07/23 18:17:12 jenglish Exp $.so man.macros.TH Tcl_OpenFileChannel 3 8.3 Tcl "Tcl Library Procedures".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMETcl_OpenFileChannel, Tcl_OpenCommandChannel, Tcl_MakeFileChannel, Tcl_GetChannel, Tcl_GetChannelNames, Tcl_GetChannelNamesEx, Tcl_RegisterChannel, Tcl_UnregisterChannel, Tcl_DetachChannel, Tcl_IsStandardChannel, Tcl_Close, Tcl_ReadChars, Tcl_Read, Tcl_GetsObj, Tcl_Gets, Tcl_WriteObj, Tcl_WriteChars, Tcl_Write, Tcl_Flush, Tcl_Seek, Tcl_Tell, Tcl_GetChannelOption, Tcl_SetChannelOption, Tcl_Eof, Tcl_InputBlocked, Tcl_InputBuffered, Tcl_OutputBuffered, Tcl_Ungets, Tcl_ReadRaw, Tcl_WriteRaw \- buffered I/O facilities using channels.SH SYNOPSIS.nf\fB#include <tcl.h>\fR.spTcl_Channel\fBTcl_OpenFileChannel\fR(\fIinterp, fileName, mode, permissions\fR).spTcl_Channel\fBTcl_OpenCommandChannel\fR(\fIinterp, argc, argv, flags\fR).spTcl_Channel\fBTcl_MakeFileChannel\fR(\fIhandle, readOrWrite\fR).spTcl_Channel\fBTcl_GetChannel\fR(\fIinterp, channelName, modePtr\fR).VS 8.3.spint\fBTcl_GetChannelNames\fR(\fIinterp\fR).spint\fBTcl_GetChannelNamesEx\fR(\fIinterp, pattern\fR).VE.spvoid\fBTcl_RegisterChannel\fR(\fIinterp, channel\fR).spint\fBTcl_UnregisterChannel\fR(\fIinterp, channel\fR).spint\fBTcl_DetachChannel\fR(\fIinterp, channel\fR).spint\fBTcl_IsStandardChannel\fR(\fIchannel\fR).spint\fBTcl_Close\fR(\fIinterp, channel\fR).sp.VS 8.1int\fBTcl_ReadChars\fR(\fIchannel, readObjPtr, charsToRead, appendFlag\fR).spint\fBTcl_Read\fR(\fIchannel, readBuf, bytesToRead\fR).spint\fBTcl_GetsObj\fR(\fIchannel, lineObjPtr\fR).spint\fBTcl_Gets\fR(\fIchannel, lineRead\fR).spint\fBTcl_Ungets\fR(\fIchannel, input, inputLen, addAtEnd\fR).spint\fBTcl_WriteObj\fR(\fIchannel, writeObjPtr\fR).spint\fBTcl_WriteChars\fR(\fIchannel, charBuf, bytesToWrite\fR).spint\fBTcl_Write\fR(\fIchannel, byteBuf, bytesToWrite\fR).VE.VS 8.3.2.spint\fBTcl_ReadRaw\fR(\fIchannel, readBuf, bytesToRead\fR).spint\fBTcl_WriteRaw\fR(\fIchannel, byteBuf, bytesToWrite\fR).VE.spint\fBTcl_Eof\fR(\fIchannel\fR).spint\fBTcl_Flush\fR(\fIchannel\fR).spint\fBTcl_InputBlocked\fR(\fIchannel\fR).spint\fBTcl_InputBuffered\fR(\fIchannel\fR).VS 8.4.spint\fBTcl_OutputBuffered\fR(\fIchannel\fR).VE.spint\fBTcl_Seek\fR(\fIchannel, offset, seekMode\fR).spint\fBTcl_Tell\fR(\fIchannel\fR).spint\fBTcl_GetChannelOption\fR(\fIinterp, channel, optionName, optionValue\fR).spint\fBTcl_SetChannelOption\fR(\fIinterp, channel, optionName, newValue\fR).sp.SH ARGUMENTS.AS Tcl_ChannelType newClientProcPtr in.AP Tcl_Interp *interp inUsed for error reporting and to look up a channel registered in it..AP "CONST char" *fileName inThe name of a local or network file..AP "CONST char" *mode inSpecifies how the file is to be accessed. May have any of the valuesallowed for the \fImode\fR argument to the Tcl \fBopen\fR command. .AP int permissions inPOSIX-style permission flags such as 0644. If a new file is created, thesepermissions will be set on the created file..AP int argc inThe number of elements in \fIargv\fR..AP "CONST char" **argv inArguments for constructing a command pipeline. These values have the samemeaning as the non-switch arguments to the Tcl \fBexec\fR command..AP int flags inSpecifies the disposition of the stdio handles in pipeline: OR-edcombination of \fBTCL_STDIN\fR, \fBTCL_STDOUT\fR, \fBTCL_STDERR\fR, and\fBTCL_ENFORCE_MODE\fR. If \fBTCL_STDIN\fR is set, stdin for the first childin the pipe is the pipe channel, otherwise it is the same as the standardinput of the invoking process; likewise for \fBTCL_STDOUT\fR and\fBTCL_STDERR\fR. If \fBTCL_ENFORCE_MODE\fR is not set, then the pipe canredirect stdio handles to override the stdio handles for which\fBTCL_STDIN\fR, \fBTCL_STDOUT\fR and \fBTCL_STDERR\fR have been set. If itis set, then such redirections cause an error..AP ClientData handle inOperating system specific handle for I/O to a file. For Unix this is afile descriptor, for Windows it is a HANDLE..AP int readOrWrite inOR-ed combination of \fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR to indicatewhat operations are valid on \fIhandle\fR..AP "CONST char" *channelName inThe name of the channel. .AP int *modePtr outPoints at an integer variable that will receive an OR-ed combination of\fBTCL_READABLE\fR and \fBTCL_WRITABLE\fR denoting whether the channel isopen for reading and writing..VS 8.3.AP "CONST char" *pattern inThe pattern to match on, passed to Tcl_StringMatch, or NULL..VE.AP Tcl_Channel channel inA Tcl channel for input or output. Must have been the return valuefrom a procedure such as \fBTcl_OpenFileChannel\fR..VS 8.1 br.AP Tcl_Obj *readObjPtr in/outA pointer to a Tcl Object in which to store the characters read from thechannel..AP int charsToRead inThe number of characters to read from the channel. If the channel's encoding is \fBbinary\fR, this is equivalent to the number of bytes to read from the channel..AP int appendFlag inIf non-zero, data read from the channel will be appended to the object.Otherwise, the data will replace the existing contents of the object..AP char *readBuf outA buffer in which to store the bytes read from the channel..AP int bytesToRead inThe number of bytes to read from the channel. The buffer \fIreadBuf\fR mustbe large enough to hold this many bytes..AP Tcl_Obj *lineObjPtr in/outA pointer to a Tcl object in which to store the line read from thechannel. The line read will be appended to the current value of theobject. .AP Tcl_DString *lineRead in/outA pointer to a Tcl dynamic string in which to store the line read from thechannel. Must have been initialized by the caller. The line read will beappended to any data already in the dynamic string..VS 8.3.AP "CONST char" *input inThe input to add to a channel buffer..AP int inputLen inLength of the input.AP int addAtEnd inFlag indicating whether the input should be added to the end orbeginning of the channel buffer..VE.AP Tcl_Obj *writeObjPtr inA pointer to a Tcl Object whose contents will be output to the channel..AP "CONST char" *charBuf inA buffer containing the characters to output to the channel..AP "CONST char" *byteBuf inA buffer containing the bytes to output to the channel..AP int bytesToWrite inThe number of bytes to consume from \fIcharBuf\fR or \fIbyteBuf\fR andoutput to the channel..VE.AP int offset inHow far to move the access point in the channel at which the next input oroutput operation will be applied, measured in bytes from the positiongiven by \fIseekMode\fR. May be either positive or negative..AP int seekMode inRelative to which point to seek; used with \fIoffset\fR to calculate the newaccess point for the channel. Legal values are \fBSEEK_SET\fR,\fBSEEK_CUR\fR, and \fBSEEK_END\fR..AP "CONST char" *optionName inThe name of an option applicable to this channel, such as \fB\-blocking\fR.May have any of the values accepted by the \fBfconfigure\fR command..AP Tcl_DString *optionValue inWhere to store the value of an option or a list of all options and theirvalues. Must have been initialized by the caller..AP "CONST char" *newValue inNew value for the option given by \fIoptionName\fR..BE.SH DESCRIPTION.PPThe Tcl channel mechanism provides a device-independent andplatform-independent mechanism for performing buffered inputand output operations on a variety of file, socket, and device
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -