Skip to content

Modern Fs Stream Seek

Paul Squires edited this page Oct 22, 2026 · 3 revisions

Home › Filesystem › File Streams › Stream.Seek

Stream.Seek

Moves the position from the start, the current place or the end; returns the new position.

Syntax

Stream.Seek( offset [, origin ] )

Notes

  • Moves the position and returns the new absolute position. origin is a SeekOrigin, SEEK_FROM_START by default.
  • A resulting position below 0 is FS_INVALID_ARGUMENT. Past the end is allowed.

Examples

#import "std/fs"
using fs

dim as MemoryStream m = MemoryStream( "abcdef" )
print m.Seek( -2, SEEK_FROM_END ).Value( )    '' 4
print m.Seek( -9, SEEK_FROM_CURRENT ).IsOk( ) '' false

Library: Filesystem Library Category: File Streams Documented under: Streams

Clone this wiki locally