FileStream.Create

Fore Syntax

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

Parameters

FileName - path and name of the file, to which one is linked.

OpenMode - parameter that determines a type of query to open a 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