putvar (string FileName, string VarName, var Value)

getvar (string FileName, string VarName): var

Writes, updates, or reads a variable to or from a file or the Windows registry. Can be used for storing data globally or exchanging data between different scripts or Zorro instances.

Parameters:

FileName Name of the file. If it does not exist, it is created. If 0, the variable is stored in the Windows registry.
VarName Name of the variable.
Value Value to be written or updated.

Returns:

Current variable value (getvar). If the variable does not yet exist, 0 is returned.

Remarks:

Example:

function increase_global_counter(string Name)
{
  string FileName = "\\Log\\Counters.csv";
  lock();
  int Counter = getvar(FileName,Name);
  putvar(FileName,Name,Counter+1);
  unlock();
}

See also:

file, strvar, lock

► latest version online