IFileInfo.Open

Syntax

Open(Mode: FileOpenMode; Share: FileShare): IFileStream;

Parameters

Mode - parameter that determines a type of query for file opening.

Share - parameter that determines a possibility of shared access to an opened file.

Description

The Open method opens a file with the specific query of file opening and parameters of shared access.

Example

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 the example a bytes sequence is written into the the 1.txt file.

See also:

IFileInfo