paCfgDeleteValue()

The function deletes the first occurrence (top down) of the specified key (config entry) or key/value pair from the specified section in the config file.

Synopsis

int paCfgDeleteValue(string filename, string section, string key [, <type> value [, string host]]);

Parameter

Parameter Description
filename The file name of the config file, for example,. "config" or "config.level". The name must be specified by using an absolute path.
section The section of the config file, for example, "general"
key The config entry that is deleted from the config file, for example, "langs".
value The value that is deleted from the config file, for example, "en_US.utf8".
host If a host entry was specified, it is used for filtering relevant rows.

Return value

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

Error

Missing or wrong arguments.

Description

The function deletes the first occurrence (top down) of the specified key (config entry) or key/value pair from the specified section in the config file.

You have to include the CtrlPv2Admin DLL into the general part of the code (to be able to use the paCfgDeleteValue function) as follows: #uses "CtrlPv2Admin"

Example

The following example deletes the config entry langs = "en_US.utf8" from the [general] section of the config file (of the project MyProj).

main()
{
  int val;
  string filename = "c:/pvss_projects/MyProj/config/config";
  string section = "general";
  val = paCfgDeleteValue(filename, section, "langs",
  "en_US.utf8");
  /* Deletes the entry "langs" containing the value "en_US.utf8"
  from the [general] section of the config file (of the project
  MyProj) */
}

Example

The following example deletes the entry LoadCtrlLibs with the value mp.ctl from the [ctrl] section of the config.level file.

main()
{
  int val;
  string filename = "C:/Siemens/Automation/WinCC_OA/3.20/config/config.level";
  string section = "ctrl";
  val = paCfgDeleteValue(filename, section, "LoadCtrlLibs",
  "mp.ctl");
  /* Deletes the LoadCtrlLibs entry with the value mp.ctl from the
  [ctrl] section of the config.level file */
}

Assignment

Project administration functions

Availability

CTRL