[Overview][Constants][Types][Classes][Procedures and functions][Variables] | Reference for unit 'Objects' (#rtl) |
Set file position.
Source position: objects.pp line 317
procedure TDosStream.Seek( |
Pos: LongInt |
); virtual; |
If the stream's status is stOK, then Seek sets the file position to Pos. Pos is a zero-based offset, counted from the beginning of the file.
In case an error occurs, the stream's status is set to stSeekError, and the OS error code is stored in ErrorInfo.
|
Set stream position. |
|
|
Return current position in the stream |
Program ex17; { Program to demonstrate the TStream.Seek method } Uses Objects; Var L : String; Marker : Word; P : PString; S : PDosStream; begin L:='Some constant string'; { Buffer size of 100 } S:=New(PDosStream,Init('test.dat',stcreate)); Writeln ('Writing "',L,'" to stream.'); S^.WriteStr(@L); Marker:=S^.GetPos; Writeln ('Set marker at ',Marker); L:='Some other constant String'; Writeln ('Writing "',L,'" to stream.'); S^.WriteStr(@L); S^.Close; S^.Open (stOpenRead); Writeln ('Size of stream is : ',S^.GetSize); Writeln ('Seeking to marker'); S^.Seek(Marker); P:=S^.ReadStr; L:=P^; DisposeStr(P); Writeln ('Read "',L,'" from stream.'); S^.Close; Dispose (S,Done); end.
No notes exist for this page yet.