TDosStream.Open¶
Open the file stream.
Declaration¶
Source position: objects.pp line 367
procedure TDosStream.Open(OpenMode: Word); virtual;
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¶
| Name | Description |
|---|---|
| TStream.Open | Open the stream. |
| TDosStream.Close | Close the file. |
Example¶
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.