1Tcl_GetStdChannel(3)        Tcl Library Procedures        Tcl_GetStdChannel(3)
2
3
4
5______________________________________________________________________________
6

NAME

8       Tcl_GetStdChannel,  Tcl_SetStdChannel  -  procedures for retrieving and
9       replacing the standard channels
10

SYNOPSIS

12       #include <tcl.h>
13
14       Tcl_Channel
15       Tcl_GetStdChannel(type)
16
17       Tcl_SetStdChannel(channel, type)
18
19

ARGUMENTS

21       int           type      (in)      The identifier for the standard chan‐
22                                         nel  to  retrieve or modify.  Must be
23                                         one  of  TCL_STDIN,  TCL_STDOUT,   or
24                                         TCL_STDERR.
25
26       Tcl_Channel   channel   (in)      The  channel  to use as the new value
27                                         for the specified standard channel.
28_________________________________________________________________
29
30

DESCRIPTION

32       Tcl defines three special channels that are used by various I/O related
33       commands  if no other channels are specified.  The standard input chan‐
34       nel has a channel name of stdin and is used  by  read  and  gets.   The
35       standard output channel is named stdout and is used by puts.  The stan‐
36       dard error channel is named stderr and is used  for  reporting  errors.
37       In addition, the standard channels are inherited by any child processes
38       created using exec or open in the absence of any other redirections.
39
40       The standard channels are actually aliases for other  normal  channels.
41       The current channel associated with a standard channel can be retrieved
42       by calling Tcl_GetStdChannel with  one  of  TCL_STDIN,  TCL_STDOUT,  or
43       TCL_STDERR  as  the type.  The return value will be a valid channel, or
44       NULL.
45
46       A new channel can be set for the standard channel specified by type  by
47       calling  Tcl_SetStdChannel  with  a  new channel or NULL in the channel
48       argument.  If the specified channel  is  closed  by  a  later  call  to
49       Tcl_Close,  then  the corresponding standard channel will automatically
50       be set to NULL.
51
52       If Tcl_GetStdChannel is called before Tcl_SetStdChannel, Tcl will  con‐
53       struct a new channel to wrap the appropriate platform-specific standard
54       file handle.  If Tcl_SetStdChannel is called before  Tcl_GetStdChannel,
55       then the default channel will not be created.
56
57       If  one  of  the  standard  channels  is set to NULL, either by calling
58       Tcl_SetStdChannel with a NULL channel argument, or by calling Tcl_Close
59       on  the channel, then the next call to Tcl_CreateChannel will automati‐
60       cally set the standard channel with the newly created channel.  If more
61       than  one  standard channel is NULL, then the standard channels will be
62       assigned starting with standard input,  followed  by  standard  output,
63       with standard error being last.
64
65       See Tcl_StandardChannels for a general treatise about standard channels
66       and the behaviour of the Tcl library with regard to them.
67

SEE ALSO

69       Tcl_Close(3), Tcl_CreateChannel(3), Tcl_Main(3), tclsh(1)
70
71

KEYWORDS

73       standard channel, standard input, standard output, standard error
74
75
76
77Tcl                                   7.5                 Tcl_GetStdChannel(3)
Impressum