Sets the current position of this stream to the given value.
[Visual Basic] Overrides Public Function Seek( _ ByVal offset As Long, _ ByVal origin As SeekOrigin _ ) As Long [C#] public override long Seek( long offset, SeekOrigin origin ); [C++] public: override __int64 Seek( __int64 offset, SeekOrigin origin ); [JScript] public override function Seek( offset : long, origin : SeekOrigin ) : long;
The new position in the stream.
Exception Type | Condition |
---|---|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support seeking. |
EndOfStreamException | Seeking was attempted past the end of a stream that does not support this. |
The position cannot be set more than one byte beyond the end of the stream. You can set the position to just beyond the last byte so you can append to the file. Opening a new file and then writing to it requires this.