1mNAME0m
       fconfigure - Set and get options on a channel

1mSYNOPSIS0m
       1mfconfigure 4m22mchannelId0m
       1mfconfigure 4m22mchannelId24m 4mname0m
       1mfconfigure 4m22mchannelId24m 4mname24m 4mvalue24m ?4mname24m 4mvalue24m 4m...24m?


1mDESCRIPTION0m
       The  1mfconfigure 22mcommand sets and retrieves options for channels.  4mChan-0m
       4mnelId24m identifies the channel for which to set or query an  option.   If
       no  4mname24m  or  4mvalue24m  arguments are supplied, the command returns a list
       containing alternating option names and values  for  the  channel.   If
       4mname24m  is  supplied  but  no  4mvalue24m then the command returns the current
       value of the given option.  If one or more pairs of 4mname24m and 4mvalue24m  are
       supplied, the command sets each of the named options to the correspond-
       ing 4mvalue24m; in this case the return value is an empty string.

       The options described below are supported for all  channels.  In  addi-
       tion,  each channel type may add options that only it supports. See the
       manual entry for the command that creates each type of channels for the
       options  that  that specific type of channel supports. For example, see
       the manual entry for the 1msocket 22mcommand for its additional options.

       1m-blocking 4m22mboolean0m
              The 1m-blocking 22moption determines whether I/O  operations  on  the
              channel  can cause the process to block indefinitely.  The value
              of the option must be a proper boolean value.  Channels are nor-
              mally in blocking mode;  if a channel is placed into nonblocking
              mode it will affect the  operation  of  the  1mgets22m,  1mread22m,  1mputs22m,
              1mflush22m,  and 1mclose 22mcommands; see the documentation for those com-
              mands for details.  For nonblocking mode to work correctly,  the
              application  must  be  using the Tcl event loop (e.g. by calling
              1mTcl_DoOneEvent 22mor invoking the 1mvwait 22mcommand).

       1m-buffering 4m22mnewValue0m
              If 4mnewValue24m is 1mfull 22mthen the I/O system will buffer output until
              its  internal  buffer  is  full  or  until  the 1mflush 22mcommand is
              invoked. If 4mnewValue24m is 1mline22m, then the I/O system will automati-
              cally  flush output for the channel whenever a newline character
              is output. If 4mnewValue24m is 1mnone22m, the I/O system will flush  auto-
              matically  after  every  output  operation.   The default is for
              1m-buffering 22mto be set to 1mfull 22mexcept for channels that connect to
              terminal-like devices; for these channels the initial setting is
              1mline22m.  Additionally, 1mstdin 22mand 1mstdout 22mare intially set to  1mline22m,
              and 1mstderr 22mis set to 1mnone22m.

       1m-buffersize 4m22mnewSize0m
              4mNewvalue24m  must  be an integer; its value is used to set the size
              of buffers, in bytes, subsequently allocated for this channel to
              store input or output. 4mNewvalue24m must be between ten and one mil-
              lion, allowing buffers of ten to one million bytes in size.

       1m-encoding 4m22mname0m
              This option is used to specify the encoding of the  channel,  so
              that  the  data  can be converted to and from Unicode for use in
              Tcl.  For instance, in order for Tcl to read characters  from  a
              Japanese  file  in 1mshiftjis 22mand properly process and display the
              contents, the encoding would be set  to  1mshiftjis22m.   Thereafter,
              when  reading  from  the channel, the bytes in the Japanese file
              would be converted to Unicode as they are read.  Writing is also
              supported  - as Tcl strings are written to the channel they will
              automatically be converted to the specified encoding on  output.

              If  a  file  contains  pure  binary  data  (for instance, a JPEG
              image), the encoding for the channel should be configured to  be
              1mbinary22m.   Tcl  will then assign no interpretation to the data in
              the file and simply read or write raw  bytes.   The  Tcl  1mbinary0m
              command can be used to manipulate this byte-oriented data.

              The default encoding for newly opened channels is the same plat-
              form- and locale-dependent system encoding used for  interfacing
              with the operating system.

       1m-eofchar 4m22mchar0m

       1m-eofchar {4m22minChar24m 4moutChar24m1m}0m
              This  option supports DOS file systems that use Control-z (\x1a)
              as an end of file marker.  If 4mchar24m is not an empty string,  then
              this character signals end-of-file when it is encountered during
              input.  For output, the end-of-file character is output when the
              channel  is  closed.  If 4mchar24m is the empty string, then there is
              no special end of file character marker.  For  read-write  chan-
              nels,  a  two-element  list specifies the end of file marker for
              input and output, respectively.  As a convenience, when  setting
              the end-of-file character for a read-write channel you can spec-
              ify a single value that will apply to both reading and  writing.
              When querying the end-of-file character of a read-write channel,
              a two-element list will always be returned.  The  default  value
              for  1m-eofchar  22mis the empty string in all cases except for files
              under Windows.  In that case the 1m-eofchar  22mis  Control-z  (\x1a)
              for reading and the empty string for writing.

       1m-translation 4m22mmode0m

       1m-translation {4m22minMode24m 4moutMode24m1m}0m
              In  Tcl  scripts the end of a line is always represented using a
              single newline character (\n).  However,  in  actual  files  and
              devices the end of a line may be represented differently on dif-
              ferent platforms, or even for  different  devices  on  the  same
              platform.   For  example, under UNIX newlines are used in files,
              whereas carriage-return-linefeed sequences are normally used  in
              network  connections.   On  input (i.e., with 1mgets 22mand 1mread22m) the
              Tcl I/O system automatically translates the external end-of-line
              representation into newline characters.  Upon output (i.e., with
              1mputs22m), the I/O system translates newlines to the  external  end-
              of-line  representation.   The  default  translation mode, 1mauto22m,
              handles all the common cases automatically, but the 1m-translation0m
              option  provides  explicit control over the end of line transla-
              tions.

              The value associated with 1m-translation  22mis  a  single  item  for
              read-only  and  write-only channels.  The value is a two-element
              list for read-write channels; the read translation mode  is  the
              first element of the list, and the write translation mode is the
              second element.  As a convenience, when setting the  translation
              mode  for  a  read-write  channel you can specify a single value
              that will apply to both reading and writing.  When querying  the
              translation  mode  of  a  read-write channel, a two-element list
              will always be returned.  The  following  values  are  currently
              supported:

              1mauto   22mAs the input translation mode, 1mauto 22mtreats any of newline
                     (1mlf22m), carriage return (1mcr22m), or carriage  return  followed
                     by  a  newline  (1mcrlf22m) as the end of line representation.
                     The end of line representation can even change from line-
                     to-line,  and  all cases are translated to a newline.  As
                     the output translation mode, 1mauto 22mchooses a platform spe-
                     cific  representation;  for  sockets on all platforms Tcl
                     chooses 1mcrlf22m, for all Unix flavors, it  chooses  1mlf22m,  for
                     the  Macintosh platform it chooses 1mcr 22mand for the various
                     flavors of Windows it chooses 1mcrlf22m.  The default  setting
                     for 1m-translation 22mis 1mauto 22mfor both input and output.

              1mbinary 22mNo  end-of-line  translations  are  performed.   This  is
                     nearly identical to 1mlf  22mmode,  except  that  in  addition
                     1mbinary  22mmode  also  sets the end-of-file character to the
                     empty string (which disables it) and sets the encoding to
                     1mbinary  22m(which  disables  encoding  filtering).   See the
                     description of 1m-eofchar 22mand 1m-encoding 22mfor  more  informa-
                     tion.

              1mcr     22mThe  end  of  a  line in the underlying file or device is
                     represented by a single carriage  return  character.   As
                     the  input  translation  mode,  1mcr 22mmode converts carriage
                     returns to newline characters.  As the output translation
                     mode,  1mcr  22mmode translates newline characters to carriage
                     returns.  This mode is typically used on Macintosh  plat-
                     forms.

              1mcrlf   22mThe  end  of  a  line in the underlying file or device is
                     represented by a carriage return character followed by  a
                     linefeed  character.  As the input translation mode, 1mcrlf0m
                     mode converts carriage-return-linefeed sequences to  new-
                     line  characters.   As  the output translation mode, 1mcrlf0m
                     mode translates newline  characters  to  carriage-return-
                     linefeed  sequences.  This mode is typically used on Win-
                     dows platforms and for network connections.

              1mlf     22mThe end of a line in the underlying  file  or  device  is
                     represented by a single newline (linefeed) character.  In
                     this mode no translations occur during  either  input  or
                     output.  This mode is typically used on UNIX platforms.



1mSEE ALSO0m
       close(n), flush(n), gets(n), puts(n), read(n), socket(n)


1mKEYWORDS0m
       blocking,  buffering, carriage return, end of line, flushing, linemode,
       newline, nonblocking, platform,  translation,  encoding,  filter,  byte
