sosStringGet (Function)

Top  Previous  Next

Architecture:

NX32L

Firmware version:

1.00.00


sosStringGet will retrieve the current value of a string object.

 

Input:

key : STRING

The key for the object to retrieve.

Note: Starting with runtime firmware V2.40.00, the key can be prefixed with "!" to access system objects.

 

Output:

str : STRING

The value of the object.

 

Returns: INT

0

- The value has been retrieved.

-1

- Generic error.

-10

- Object not found.

-11

- Object has the wrong type.

 

 

Declaration:

FUNCTION sosStringGet : INT;
VAR_INPUT
   key   : STRING;
   str   : ACCESS 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 => " + namev1:=rc);
   ...
END;
 
END_PROGRAM;