7.3 标准端口
本节中描述的过程返回连接到进程的 stdin, stdout, stderr 的端口。第一个集合返回“现成”的文本端口(可能包含与实现相关的 transcoders, 及缓冲模式); 第二组过程创建新的二进制端口,可以用于二进制输入/输出,或者在 transcoded-port
过程的帮助下,附加 transcoder
及 b-mode
转变为文本端口。
procedure: (current-input-port)
returns: the current input port
procedure: (current-output-port)
returns: the current output port
procedure: (current-error-port)
returns: the current error port
libraries: (rnrs io ports), (rnrs io simple), (rnrs)
The current-input, current-output, and current-error ports return pre-built textual ports that are initially associated with a process's standard input, standard output, and standard error streams.
current-input-port
及 current-output-port
可以被简便I/O过程(Section 7.9) with-input-from-file
及 with-output-to-file
暂时时改变.
procedure: (standard-input-port)
returns: a fresh binary input port connected to the standard input stream
procedure: (standard-output-port)
returns: a fresh binary output port connected to the standard output stream
procedure: (standard-error-port)
returns: a fresh binary output port connected to the standard error stream
libraries: (rnrs io ports), (rnrs)
Because ports may be buffered, confusion can result if operations on more than one port attached to one of a process's standard streams are interleaved. Thus, these procedures are typically appropriate only when a program no longer needs to use any existing ports attached to the standard streams.