SaveToFile saves the string given by aContents as a file on disk named as specified by aFileName. Also see LoadFileToString.

SaveToFile does not handle unicode characters. Rather, use the WideString version SaveWideStringToFile. Please also see SaveWideStringToFile.

If a file with aFileName already exists, then it will be overwritten - if attributes and permissions allow. If permissions and attributes do not allow it to be overwritten, then an exception error will be encountered.

Declaration: Procedure SaveToFile(const aContents, aFileName : string)

A good example as below.

procedure OnMapEvent(var Value:Variant);
var vData : string;
begin
vData := 'abcde';
SaveToFile(vData, 'c:\Temp\TodayTest.txt');
end;