BinaryReader.Create

Syntax

Create(Stream: IIOStream);

Parameters

Stream. Stream, from which binary data is read.

Description

The Create constructor creates an object that enables the user to read binary data.

Comments

Specify the stream connected with the place where binary data is stored as a value of the Stream parameter. Initialize the object of one of the following classes and specify it as a value of the Stream parameter:

Example

Sub UserProc;
Var
    f: IFileStream;
    BinRead: IBinaryReader;
    s: String;
Begin
    If File.Exists("c:\BinFile.dat"Then
        f := New FileStream.Create("c:\BinFile.dat", FileOpenMode.Read, FileShare.DenyNone);
        BinRead := New BinaryReader.Create(f);
        s := BinRead.ReadString;
        Debug.WriteLine(s);
        Dispose f;
    End If;
End Sub UserProc;

On executing the example it is checked whether if the BinFile.dat file exists. If the file exists, a character string will be read from it. The read value is displayed in the development environment console.

See also:

BinaryReader