sosStringSet will update the value of an existing string object.
Input:
key : STRING
The key for the object to update.
str : STRING
The new value for the object.
Returns: INT
0
|
- The object is updated.
|
-1
|
- Generic error.
|
-2
|
- Invalid parameter.
|
-10
|
- Object not found.
|
-11
|
- Object has the wrong type.
|
Declaration:
FUNCTION sosStringSet : INT;
VAR_INPUT
key : STRING;
str : STRING;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM test;
VAR
rc : INT;
name : STRING;
END_VAR;
BEGIN
...
rc := sosStringCreate(key := "config.name", str:="Test configuration", desc := "Name of the configuration", max_len := 50);
DebugFmt(message:="sosStringCreate=\1", v1:=rc);
rc:= sosStringSet(key:="config.name", str:="New name");
DebugFmt(message:="sosStringSet=\1", v1:=rc);
rc:= sosStringGet(key:="config.name", str:=name);
DebugFmt(message:="sosStringGet=\1 => " + name, v1:=rc);
...
END;
END_PROGRAM;
|