Next Previous Up Top Contents Index

5.11 The STREAMS module

stream-position

Open generic function

Summary

Finds the current position of a positionable stream.

Signature

stream-position positionable-stream => position 

Arguments

positionable-stream

An instance of <positionable-stream>.

Values

position
An instance of <position-type>.

Library

io

Module

streams

Description

Returns the current position of positionable-stream for reading or writing.

The value returned can be either an instance of <stream-position> or an integer. When the value is an integer, it is an offset from position zero, and is in terms of the stream's element type. For instance, in a Unicode stream, a position of four means that four Unicode characters have been read.

Example

The following example uses positioning to return the character "w" from a stream over the string "hello world":

let stream = make(<string-stream>, 
                  contents: "hello world");
stream-position(stream) := 6;
read-element(stream);

See also

<position-type>, page 82


System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index