Open generic function
Moves the position of a positionable stream by a specified amount.
adjust-stream-position positionable-stream delta #key from => new-position
An instance of <positionable-stream>.
<integer>.
#"current", #"start", or #"end". Default value: #"current".
<stream-position>.
io
streams
io
streams
Moves the position of positionable-stream to be offset delta elements from the position indicated by from. The new position is returned.
When from is #"start", the stream is positioned relative to the beginning of the stream. When from is #"end", the stream is positioned relative to its end. When from is #"current", the current position is used.
Using adjust-stream-position to set the position of a stream to be beyond its current last element causes the underlying aggregate to be grown to a new size. When extending the underlying aggregate for a stream, the contents of the unwritten elements are the fill character for the underlying sequence.
The following example returns a string, the first ten characters of which are the space character, which is the fill character for the sequence <string>.
let stream = make(<string-stream>,
direction: #"output");
adjust-stream-position(stream, 10);
write(stream, "whoa!");
stream-contents(stream);