ADVANCED: strFromMemory (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

ALL

Firmware version:

1.00 / 1.00.00


strFromMemory will copy the contents of a memory area to string.

 

Note that the returned string is a dynamic string.

 

Input:

src : PTR

Pointer to the memory where the string should be copied from.

 

len : INT

Number of bytes to be copied from memory.

 

Returns: STRING

The string copied from the memory area.

 

Declaration:

FUNCTION strFromMemory : STRING;
VAR_INPUT
  src : PTR;
  len : INT;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR
  data : ARRAY[0..100] OF SINT;
  s         : STRING;
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
 s:=strFromMemory(src:=ADDR(data), len:=SIZEOF(data));
  // The string 's' will now contain the data (string) from the array 'data'
  ...
END;
 
END_PROGRAM;