TextReader.Create

Syntax

Create(Stream: IIOStream);

Parameters

Stream. The stream, from which text data is read.

Description

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

Comments

Specify the stream connected with the place where text 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;
    TxtRead: ITextReader;
    s: String;
Begin
    If File.Exists("c:\File.txt"Then
        f := New FileStream.Create("c:\File.txt", FileOpenMode.Read, FileShare.DenyNone);
        TxtRead := New TextReader.Create(f);
        s := TxtRead.ReadLine;
        Debug.WriteLine(s);
        Dispose f;
    End If;
End Sub UserProc;

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

See also:

TextReader