Seek(Offset: Integer; Origin: SeekOrigin): Integer;
Offset - offset in a stream.
Origin - parameter that determines a stream point that is used to get a new position.
The Seek method sets a position in a stream taking into account offset parameters and stream positioning.
Sub UserProc;
Var
File1: IFileInfo;
BinW: IBinaryWriter;
Stream: IIOStream;
Begin
File1 := New FileInfo.Attach("c:\1.dat");
If File1.Exists Then
BinW := File1.OpenBinaryWriter(False);
Stream := BinW.Stream;
Stream.Seek(Math.Int(Stream.Size / 2), SeekOrigin.Beginning);
Stream.WriteByte(32);
Stream.WriteByte(32);
End If;
Dispose File1;
End Sub UserProc;
After executing the example the cursor is placed in the middle of a stream, it is positioned relative to the beginning of a stream, then 2 bytes are written into the file.
See also: