paCfgReadValueList()

The function reads all values of a config entry that exist more than once in a config file. The function can be used, for example, for reading the values of the proj_path entry, the LoadCtrlLibs entry or others.

Synopsis

int paCfgReadValueList(string filename, string section, string key, dyn_string &value[, string separator[, string host]]);

Parameters

Parameter Description
filename The file name of the config file e.g. "config" or "config.level".
section The section of the config file, for example, "general"
key The config entry whose value will be read, for example, "langs"
value The value that is read.
separator The function separates the value per entry/value pair with a separator.
host If this parameter has been specified, only the entries with this host, for example, $host1 will be read. If an entry is empty "", only entries without a host name will be read. If no host parameter has been specified, no host entries will be read.

Return value

In case of errors, the function returns -1 otherwise, 0.

The following example reads all values of the LoadCtrlLibs entries from all sections of the config.level file. The values are separated by a separator. All sections of the file are specified by an empty string string section = "";

#uses "CtrlPv2Admin

main()
{
   int val;
   string filename = "c:/Programme/ETM/PVSS2/3.0/config/config.level";
   string section = "ui";
   string separator = ",";
   dyn_string val1;
   val = paCfgReadValueList(filename,section, 
   "LoadCtrlLibs",val1,separator); /* reads all values of the 
   LoadCtrlLibs entries from ui of the config.level
    file. The values are separated by the separator
    ",". */
    DebugN(val1);
}

Note that the maximum number of characters in a line of the configuration file is restricted to 511 characters (see also Configuration file). If this number is exceeded, -1 is returned.

The following example reads all values of the langs entry from the [general] section of the config file (the project is test).

main()
{
   int val;
   string filename = "c:/WinCC_OA_Proj/test/config/config";
   string section = "general";
   dyn_string val1;
   val = paCfgReadValueList(filename,section,"langs",val1);
   DebugN(val1);
}               

Assignment

Project administration functions

Availability

CTRL