Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

BinaryWriter.Seek Method

Sets the position within the current stream.

[Visual Basic]
Public Overridable Function Seek( _
   ByVal offset As Integer, _
   ByVal origin As SeekOrigin _
) As Long
[C#]
public virtual long Seek(
 int offset,
 SeekOrigin origin
);
[C++]
public: virtual __int64 Seek(
 int offset,
 SeekOrigin origin
);
[JScript]
public function Seek(
   offset : int,
 origin : SeekOrigin
) : long;

Parameters

offset
A byte offset relative to origin.
origin
A field of SeekOrigin indicating the reference point from which the new position is to be obtained.

Return Value

The position with the current stream.

Exceptions

Exception Type Condition
IOException The file pointer was moved to an invalid location.
ArgumentException The SeekOrigin value is invalid.

Remarks

The following table lists examples of other typical or related I/O tasks.

To do this... See the example in this topic...
Create a text file. Writing Text to a File
Write to a text file. Writing Text to a File
Read from a text file. Reading Text from a File
Read from a binary file. Reading and Writing to a Newly Created Data File
Write to a binary file. Reading and Writing to a Newly Created Data File

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

BinaryWriter Class | BinaryWriter Members | System.IO Namespace | Working with I/O | Reading Text from a File | Writing Text to a File

Show:
© 2014 Microsoft