ReadConfiguration
(VTScada-Layer function. Must be called with a leading backslash.)
| Description: | This function provides a safe way to read configuration files. |
| Returns: | Nothing |
Usage: ![]() |
Script Only. |
| Function Groups: | File I/O |
| Related to: | ModifyConfiguration | ReadPropertiesFile | WCSubscribe |
Format: ![]() |
\ReadConfiguration(CallBackModuleName) |
| Parameters: |
| CallBackModuleName |
| Required text value, which is the name of the module (either launched or a subroutine that returns Invalid) . The named module is launched in the caller. |
| Comments: | The callback object is allowed to read configuration files and is guaranteed that, for the life of the module, no other configuration code can modify the file. The callback module need not have parameters of its own. ReadConfiguration will not put values in them if they exist. |
This function is session non-aware, meaning it works on the server's file system even with an active remote connection established.This function is also blocking. All concurrent thread operations will be paused until its execution has concluded. Avoid using this function to access a network file path ("\\server1\share\file.txt", for example). If the network location is unavailable while a blocking File I/O function is attempted, it will block indefinitely. It is recommended that a target file be copied to the local file system for access rather than over the network from VTScada.
Example:
If SomeTrigger;
[
SomeTrigger = 0;
\ReadConfiguration("ConfigReader");
]
…
]
<
{============================= \ConfigReader ==========================}
{======================================================================}
ConfigReader
Main [
If 1;
[
{ The first line of the file is read into InfoVal1, and the second }
{ line is read into InfoVal2. }
FRead("MyConfigFile.txt" { filename },
0 { offset },
"%l%l" { format string },
InfoVal1, InfoVal2 { return variables });
Return(Invalid);
]
]
{ End of \ConfigReader }
>
