[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] |
Open the file stream
Source position: objects.pp line 327
procedure TDosStream.Open( |
OpenMode: Word |
); virtual; |
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.
If an error occurs when re-opening the file, then Status is set to stOpenError, and the OS error code is stored in ErrorInfo
|
Open the stream |
|
|
Close the file. |
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.