You are here: Scripting Reference > Functions > File > SaveToFile

SaveToFile

Declaration

Procedure SaveToFile( const aContents, aFileName : string)

Procedure SaveWideStringToFile( const aContents : widestring; const aFileName : string)

Example

procedure OnMapEvent(var Value:Variant);

var data : string;

begin

data := 'abcde'

SaveToFile(data, 'c:\test.txt');

end;

Description

Saves the string given by aContents as a file named aFileName. Also see LoadFileToString.

Use the WideString version to handle Unicode characters.

If a file with aFileName already exists then it will be overwritten if attributes and permissions allow (if not allowed then an Exception will be raised - see Exceptions).