Tcl_GetStdChannel



Tcl_GetStdChannel

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
SEE ALSO
KEYWORDS

___________________________

NAME

Tcl_GetStdChannel, Tcl_SetStdChannel − procedures for retrieving and replacing the standard channels

SYNOPSIS

#include <tcl.h>

Tcl_Channel
Tcl_GetStdChannel
(type)

Tcl_SetStdChannel(channel, type)

ARGUMENTS

int type (in)

The identifier for the standard channel to retrieve or modify. Must be one of TCL_STDIN, TCL_STDOUT, or TCL_STDERR.

Tcl_Channel channel (in)

The channel to use as the new value for the specified standard channel.

______________

DESCRIPTION

Tcl defines three special channels that are used by various I/O related commands if no other channels are specified. The standard input channel has a channel name of stdin and is used by read and gets. The standard output channel is named stdout and is used by puts. The standard error channel is named stderr and is used for reporting errors. In addition, the standard channels are inherited by any child processes created using exec or open in the absence of any other redirections.

The standard channels are actually aliases for other normal channels. The current channel associated with a standard channel can be retrieved by calling Tcl_GetStdChannel with one of TCL_STDIN, TCL_STDOUT, or TCL_STDERR as the type. The return value will be a valid channel, or NULL.

A new channel can be set for the standard channel specified by type by calling Tcl_SetStdChannel with a new channel or NULL in the channel argument. If the specified channel is closed by a later call to Tcl_Close, then the corresponding standard channel will automatically be set to NULL.

If a non-NULL value for channel is passed to Tcl_SetStdChannel, then that same value should be passed to Tcl_RegisterChannel, like so:

Tcl_RegisterChannel(NULL, channel);

This is a workaround for a misfeature in Tcl_SetStdChannel that it fails to do some reference counting housekeeping. This misfeature cannot be corrected without contradicting the assumptions of some existing code that calls Tcl_SetStdChannel.

If Tcl_GetStdChannel is called before Tcl_SetStdChannel, Tcl will construct a new channel to wrap the appropriate platform-specific standard file handle. If Tcl_SetStdChannel is called before Tcl_GetStdChannel, then the default channel will not be created.

If one of the standard channels is set to NULL, either by calling Tcl_SetStdChannel with a NULL channel argument, or by calling Tcl_Close on the channel, then the next call to Tcl_CreateChannel will automatically set the standard channel with the newly created channel. If more than one standard channel is NULL, then the standard channels will be assigned starting with standard input, followed by standard output, with standard error being last.

See Tcl_StandardChannels for a general treatise about standard channels and the behaviour of the Tcl library with regard to them.

SEE ALSO

Tcl_Close(3), Tcl_CreateChannel(3), Tcl_Main(3), tclsh(1)

KEYWORDS

standard channel, standard input, standard output, standard error






Opportunity


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.





Free Software


Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.


Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.





Free Books


The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.


Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.





Education


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.


Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.