Open(Mode: FileOpenMode; Share: FileShare): IFileStream;
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 UserProc;
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 UserProc;
After executing the example a bytes sequence is written into the the 1.txt file.
See also: