Skip to content

LoadFileToString ​

LoadFileToString loads the contents of the file specified by aFileName into a string variable.

LoadFileToString does not handle unicode characters. To accommodate unicode, please see the WideString version LoadFileToWideString.

Declaration: Function LoadFileToString(const aFileName : string) : string

An example follows.

pascal
procedure OnMapEvent(var Value:Variant);
var vData : string;
begin
 //Reads file into string
  vData := LoadFileToString('C:\Temp\TodayTest.txt');
  LogInfo('First five characters from file: ' + Copy(vData, 1, 5));
end;