Next: Port Types, Previous: Block Reading and Writing, Up: Input and Output
Return the current input port. This is the default port used by many input procedures.
Initially this is the standard input in Unix and C terminology. When the standard input is a tty the port is unbuffered, otherwise it's fully buffered.
Unbuffered input is good if an application runs an interactive subprocess, since any type-ahead input won't go into Guile's buffer and be unavailable to the subprocess.
Note that Guile buffering is completely separate from the tty “line discipline”. In the usual cooked mode on a tty Guile only sees a line of input once the user presses <Return>.
Return the current output port. This is the default port used by many output procedures.
Initially this is the standard output in Unix and C terminology. When the standard output is a tty this port is unbuffered, otherwise it's fully buffered.
Unbuffered output to a tty is good for ensuring progress output or a prompt is seen. But an application which always prints whole lines could change to line buffered, or an application with a lot of output could go fully buffered and perhaps make explicit
force-output
calls (see Writing) at selected points.
Return the port to which errors and warnings should be sent.
Initially this is the standard error in Unix and C terminology. When the standard error is a tty this port is unbuffered, otherwise it's fully buffered.
Change the ports returned by
current-input-port
,current-output-port
andcurrent-error-port
, respectively, so that they use the supplied port for input or output.
These functions must be used inside a pair of calls to
scm_dynwind_begin
andscm_dynwind_end
(see Dynamic Wind). During the dynwind context, the indicated port is set to port.More precisely, the current port is swapped with a `backup' value whenever the dynwind context is entered or left. The backup value is initialized with the port argument.