ITextReader.ReadString

Syntax

ReadString(CharCount: Integer): String;

Parameters

CharCount — number of characters that need to be read.

Description

The ReadString method reads character string from a text file. Number of characters is passed by the CharCount parameter.

Example

Sub Main;

Var

File1: IFileInfo;

TextR: ITextReader;

s: String;

Begin

File1:=New FileInfo.Attach("c:\New_folder\1.txt");

If File1.Exists Then

TextR:=File1.OpenTextReader;

s:=TextR.ReadString(14);

End If;

Dispose File1;

End Sub Main;

After executing this example, the first 14 characters read from the text file 1.txt are contained in the "s" variable.

See also:

ITextReader