Open(Mode: FileOpenMode; Share: FileShare): IFileStream;
Mode - a parameter that determines a type of query for file opening.
Share - a parameter that determines a possibility of shared access to an open file.
The Open method opens a file with a specific query of file opening and parameters of shared access.
Sub Main;
Var
File1: IFileInfo;
FileStr: IFileStream;
i: Integer;
Begin
File1:=New FileInfo.Attach("c:\Work\1.txt");
If File1.Exists Then
FileStr:=File1.Open(FileOpenMode.Create, FileShare.DenyWrite);
For i:=0 To 255 Do
FileStr.WriteByte(i);
End For;
End If;
Dispose File1;
End Sub Main;
After executing this example, byte sequence is written into the file 1.txt.
See also: