ReadToEnd: String;
The ReadToEnd method reads a text file as one character string.
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.ReadToEnd;
End If;
Dispose File1;
End Sub Main;
After executing the example, the 1.txt file is read into the "s" variable.
See also: