TDosStream.Open procedure
Open the file stream.
Declaration
procedure Open(OpenMode: Word); virtualDescription
If the stream's status is
stOK, and the stream is closed then
Open re-opens the file stream with mode
OpenMode.
This call can be used after a
Close call.
Errors
If an error occurs when re-opening the file, then
Status is set
to
stOpenError, and the OS error code is stored in
ErrorInfo
See also
Example: ex14
Program ex14;
{ Program to demonstrate the TStream.Close method }
Uses Objects;
Var L : String;
P : PString;
S : PDosStream; { Only one with Close implemented. }
begin
L:='Some constant string';
S:=New(PDosStream,Init('test.dat',stcreate));
Writeln ('Writing "',L,'" to stream with handle ',S^.Handle);
S^.WriteStr(@L);
S^.Close;
Writeln ('Closed stream. File handle is ',S^.Handle);
S^.Open (stOpenRead);
P:=S^.ReadStr;
L:=P^;
DisposeStr(P);
Writeln ('Read "',L,'" from stream with handle ',S^.Handle);
S^.Close;
Dispose (S,Done);
end.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
