Open(FileName: String; Mode: FileOpenMode; Share: FileShare): IFileStream;
FileName - path and name of the file that must be opened.
Mode - parameter that determines a type of query for file opening.
Share - parameter that determines a possibility of shared access to an opened file.
The Open method opens a file with the specific query of file opening and parameters of shared access.
Sub Main;
Var
FileStr: IFileStream;
i: Integer;
Begin
FileStr:=File.Open("c:\New_folder\1.dat", FileOpenMode.Create, FileShare.DenyWrite);
For i:=0 To 255 Do
FileStr.WriteByte(i);
End For;
End Sub Main;
After executing the example, the 1.dat file is created and a bytes sequence is written into it. During writing this file is read-only for other applications.
See also: