sosStringSet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

All

Firmware version:

1.00.00


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
  ...
  // Create string object
  rc := sosStringCreate(key := "config.name", str:="Test configuration", desc := "Name of the configuration", max_len := 50);
  DebugFmt(message:="sosStringCreate=\1", v1:=rc);
  // Update string object
  rc:= sosStringSet(key:="config.name", str:="New name");
  DebugFmt(message:="sosStringSet=\1", v1:=rc);
 
  // Read string object
  rc:= sosStringGet(key:="config.name", str:=name);
  DebugFmt(message:="sosStringGet=\1 => " + name, v1:=rc);
  ...
END;
 
END_PROGRAM;