Next: Custom Ports, Previous: Bytevector Ports, Up: Port Types [Contents][Index]
Calls the one-argument procedure proc with a newly created output port. When the function returns, the string composed of the characters written into the port is returned. proc should not close the port.
Calls the one-argument procedure proc with a newly created input port from which string’s contents may be read. The value yielded by the proc is returned.
Calls the zero-argument procedure thunk with the current output port set temporarily to a new string port. It returns a string composed of the characters written to the current output.
Calls the zero-argument procedure thunk with the current input port set temporarily to a string port opened on the specified string. The value yielded by thunk is returned.
Take a string and return an input port that delivers characters
from the string. The port can be closed by
close-input-port
, though its storage will be reclaimed
by the garbage collector if it becomes inaccessible.
Return an output port that will accumulate characters for
retrieval by get-output-string
. The port can be closed
by the procedure close-output-port
, though its storage
will be reclaimed by the garbage collector if it becomes
inaccessible.
Given an output port created by open-output-string
,
return a string consisting of the characters that have been
output to the port so far.
get-output-string
must be used before closing port, once
closed the string cannot be obtained.
With string ports, the port-encoding is treated differently than other types of ports. When string ports are created, they do not inherit a character encoding from the current locale. They are given a default locale that allows them to handle all valid string characters. Typically one should not modify a string port’s character encoding away from its default. See Encoding.
Next: Custom Ports, Previous: Bytevector Ports, Up: Port Types [Contents][Index]