Field-Map Scripting

4.1.4.11 SaveStringToFileAsUTF8

SaveStringToFileAsUTF8 function


Prototype:

function SaveStringToFileAsUTF8(const Data,Filename :string) :boolean;

Description:

This function saves string to the file as encoding UTF8 with name Filename. Creates a new file or rewrites existing file.

Syntax:

variable := SaveStringToFileAsUTF8(Data, Filename);


Part

Description


variable

variable declared as boolean


Data

Data that will be saved to the file


Filename

The file name as a string


Return value:


True if data was written in the file correctly, otherwise False



Example:


var

  fileName, dat: string;

  check : boolean;


begin

  fileName:= 'trees3.txt';

  dat:= 'picea, abies, pinus, malus, tilia';


  check:= SaveStringToFileAsUTF8(dat, fileName);


if check = true then

begin

      ShowMessage('The data was written in the "' + fileName + '"');

end

  else

    begin

      ShowMessage('The data wasnt written in the "' + fileName + '"');

end;

end.


Output in Field-Map Data Collector:


Output in the directory:


See also:

AssignFile; Reset; Rewrite; Append; WriteLn; ReadLn; EOF; CloseFile; DeleteFile; SaveStringToFile; SaveStringToFileAsUTF8