int Ns_TclGetOpenChannel ( Tcl_Interp* , char* chanId, int write, int check, Tcl_Channel* channPtr );
This function fills in
channptr with a channel open in the passed-in interpreter if one exists. It returns TCL_OK or TCL_ERROR. The
chanId is a channel name (the handle that Tcl uses).
This function also has the ability to check if a channel is opened for reading or writing. If
check is true, the check is performed. If
write is true, the channel is checked for writeability. If
write is false, the channel is checked for readability. If the check is performed and fails, then an error is returned and appended to the interpreter.