IIOStream.ReadByte

Syntax

ReadByte: Integer;

Description

The ReadByte method reads a data byte from a stream. The method returns a byte converted into integer type.

Example

Sub UserProc;
Var
    File1: IFileInfo;
    BinR: IBinaryReader;
    Stream: IIOStream;
    IntList: IArrayList;
    i: Integer;
Begin
    File1 := New FileInfo.Attach("c:\1.dat");
    IntList := New ArrayList.Create;
    If File1.Exists Then
        BinR := File1.OpenBinaryReader;
        Stream := BinR.Stream;
        For i := 0 To File1.Size - 1 Do
            IntList.Add(Stream.ReadByte);
        End For;
    End If;
    Dispose File1;
End Sub UserProc;

After executing the example the IntList array contains a sequence of integer numbers that correspond to bytes read from the 1.dat file.

See also:

IIOStream