IFile.OpenTextReader

Syntax

OpenTextReader(FileName: String): ITextReader;

Parameters

FileName. Path and name of the file to be opened.

Description

The OpenTextReader method opens a file for reading in a text format.

Example

Sub UserProc;
Var
    TextR: ITextReader;
    d: DateTime;
Begin
    If File.Exists("c:\New_folder\1.txt"Then
        TextR := File.OpenTextReader("c:\New_folder\1.txt");
        TextR.Encoding := CodePage.UTF8;
        d := TextR.ReadDateTime;
    End If;
End Sub UserProc;

After executing the example, date and time are sent to the "d" variable from the 1.txt file. UTF-8 encoding is used when working with file.

See also:

IFile