OSDN Git Service

Updated to tcl 8.4.1
[pf3gnuchains/sourceware.git] / tcl / doc / close.n
1 '\"
2 '\" Copyright (c) 1993 The Regents of the University of California.
3 '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\" 
8 '\" RCS: @(#) $Id$
9 '\" 
10 .so man.macros
11 .TH close n 7.5 Tcl "Tcl Built-In Commands"
12 .BS
13 '\" Note:  do not modify the .SH NAME line immediately below!
14 .SH NAME
15 close \- Close an open channel.
16 .SH SYNOPSIS
17 \fBclose \fIchannelId\fR
18 .BE
19
20 .SH DESCRIPTION
21 .PP
22 Closes the channel given by \fIchannelId\fR.
23 .PP
24 .VS
25 \fIChannelId\fR must be an identifier for an open channel such as a
26 Tcl standard channel (\fBstdin\fR, \fBstdout\fR, or \fBstderr\fR),
27 the return value from an invocation of \fBopen\fR or \fBsocket\fR, or
28 the result of a channel creation command provided by a Tcl extension.
29 .VE
30 .PP
31 All buffered output is flushed to the channel's output device,
32 any buffered input is discarded, the underlying file or device is closed,
33 and \fIchannelId\fR becomes unavailable for use.
34 .VS "" br
35 .PP
36 If the channel is blocking, the command does not return until all output
37 is flushed.
38 If the channel is nonblocking and there is unflushed output, the
39 channel remains open and the command
40 returns immediately; output will be flushed in the background and the
41 channel will be closed when all the flushing is complete.
42 .VE
43 .PP
44 If \fIchannelId\fR is a blocking channel for a command pipeline then
45 \fBclose\fR waits for the child processes to complete.
46 .VS "" br
47 .PP
48 If the channel is shared between interpreters, then \fBclose\fR
49 makes \fIchannelId\fR unavailable in the invoking interpreter but has no
50 other effect until all of the sharing interpreters have closed the
51 channel.
52 When the last interpreter in which the channel is registered invokes
53 \fBclose\fR, the cleanup actions described above occur. See the
54 \fBinterp\fR command for a description of channel sharing.
55 .PP
56 Channels are automatically closed when an interpreter is destroyed and
57 when the process exits.  Channels are switched to blocking mode, to ensure
58 that all output is correctly flushed before the process exits.
59 .VE
60 .PP
61 The command returns an empty string, and may generate an error if
62 an error occurs while flushing output.
63
64 .SH "SEE ALSO"
65 file(n), open(n), socket(n), eof(n), Tcl_StandardChannels(3)
66
67 .SH KEYWORDS
68 blocking, channel, close, nonblocking