Next Previous Up Top Contents Index

5.11 The STREAMS module

adjust-stream-position

Open generic function

Summary

Moves the position of a positionable stream by a specified amount.

Signature

adjust-stream-position positionable-stream delta #key from => new-position 

Arguments

positionable-stream

An instance of <positionable-stream>.

delta
An instance of <integer>.

from
One of #"current", #"start", or #"end". Default value: #"current".

Values

new-position
An instance of <stream-position>.

Library

io

Module

streams

Library

io

Module

streams

Description

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.

Example

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);

See also

stream-position-setter, page 56


System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index