Seth Woolley's Man Viewer

Manual for puts - man n puts

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

puts(3,n)(n)                      Tcl Built-In Commands                     puts(3,n)(n)

       puts(3,n) - Write to a channel

       puts(3,n) ?-nonewline? ?channelId? string(3,n)

       Writes  the  characters  given  by string(3,n) to the channel given by chan-

       ChannelId must be an identifier for an open(2,3,n) channel such as a Tcl stan-
       dard channel (stdout or stderr), the return value from an invocation of
       open(2,3,n) or socket(2,7,n), or the result of a channel creation command provided by
       a Tcl extension. The channel must have been opened for output.

       If  no channelId is specified then it defaults to stdout. Puts normally
       outputs a newline character after string(3,n), but this feature may be  sup-
       pressed by specifying the -nonewline switch.

       Newline  characters  in(1,8)  the output are translated by puts(3,n) to platform-
       specific end-of-line sequences according to the current  value  of  the
       -translation  option  for the channel (for example, on PCs newlines are
       normally replaced with carriage-return-linefeed sequences;   on  Macin-
       toshes  newlines are normally replaced with carriage-returns).  See the
       fconfigure manual entry for a discussion on ways  in(1,8)  which  fconfigure
       will alter output.

       Tcl  buffers output internally, so characters written with puts(3,n) may not
       appear immediately on the output file(1,n) or  device;   Tcl  will  normally
       delay  output  until  the buffer is full or the channel is closed.  You
       can force output to appear immediately with the flush(8,n) command.

       When the output buffer fills up, the puts(3,n) command will  normally  block
       until all the buffered data has been accepted for output by the operat-
       ing system.  If channelId is in(1,8) nonblocking mode then the puts(3,n)  command
       will  not  block  even  if(3,n) the operating system cannot accept(2,8) the data.
       Instead, Tcl continues to buffer the data and writes it  in(1,8)  the  back-
       ground  as  fast  as  the underlying file(1,n) or device can accept(2,8) it.  The
       application must use the Tcl event loop for nonblocking output to work;
       otherwise Tcl never finds out that the file(1,n) or device is ready for more
       output data.  It is possible for an arbitrarily large amount of data to
       be  buffered  for  a channel in(1,8) nonblocking mode, which could consume a
       large amount of memory.   To  avoid  wasting  memory,  nonblocking  I/O
       should  normally  be used in(1,8) an event-driven fashion with the fileevent
       command (don't invoke puts(3,n) unless you have recently been notified via a
       file(1,n) event that the channel is ready for more output data).

       file(1,n)(n), fileevent(n), Tcl_StandardChannels(3)

       channel, newline, output, write(1,2)

Tcl                                   7.5                              puts(3,n)(n)

References for this manual (incoming links)