There are two methods of finding and setting the stream position,
stream positioning and seeking. The current position of the
read/write pointer in a specified stream can be obtained by using
stream_position/2
. It may be changed by using
stream_position/3
. Alternatively, seek/4
may be used.
Seeking is more general, and stream positioning is more portable. The differences between them are:
stream_position/2
is equivalent to seek/4
with Offset = 0,
and Method = current
.
stream_position/3
asks for stream position objects,
seek/4
uses integer expressions to represent the position or
offset. Stream position objects are obtained by calling
stream_position/[2,3]
, and are discussed in the reference page.
seek/4
is supported only on certain operating systems.
stream_position/3
is portable.