getStringCopy
Short summary
this methods copy a string and returns the start address of new string
:return: start address of the string copy
- Return type:
POINTER TO BYTE
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| stringAddress | POINTER TO BYTE | string to copy | input |
| stringLength | UDINT | length of the string | input |
Code
Declaration
METHOD PROTECTED getStringCopy :POINTER TO BYTE
VAR_INPUT
(* string to copy *)
stringAddress :POINTER TO BYTE;
(* length of the string *)
stringLength :UDINT;
END_VAR
Implementation
getStringCopy := __NEW(BYTE, stringLength);
IF (getStringCopy <> 0) THEN
Tc2_System.MEMCPY(
destAddr := getStringCopy,
srcAddr := stringAddress,
n := stringLength
);
END_IF