FileStream.Create

Syntax

Create(FileName: String; OpenMode: FileOpenMode; ShareMode: FileShare);

Parameters

FileName. Path and name of the linked file.

OpenMode. Parameter that determines a type of query to open file.

ShareMode. Parameter that determines a possibility of shared access to a file.

Description

The Create constructor creates a new stream linked to the specified file.

Example

Sub UserProc;
Var
    f: IFileStream;
    BinWriter: IBinaryWriter;
Begin
    f := New FileStream.Create("c:\BinFile.dat", FileOpenMode.Create, FileShare.Exclusive);
    BinWriter := New BinaryWriter.Create(f);
    BinWriter.WriteString("Sample Text");
    BinWriter.Flush;
    Dispose f;
End Sub UserProc;

On executing the example the new file BinFile.dat is created. The specified character string is written into this file in a binary format.

See also:

FileStream