PVOID_TO_STRING

The function converts the value of a pointer variable of type PVOID into a hexadecimal string (basis 16). The hexadecimal string has the PLC prefix: '16#'. The resolution is fixed at 8 digits in a 32-bit system.
FUNCTION PVOID_TO_STRING : T_MaxString
VAR_INPUT
in : PVOID;
END_VAR
in: The pointer variable to be converted.
Example:
PROGRAM MAIN
VAR
s1 : STRING;
s2 : STRING;
nCnt : BYTE;
p1 : POINTERTOBYTE := 0;
p2 : POINTERTOBYTE := ADR( nCnt );
END_VAR
s1 := PVOID_TO_STRING( p1 );
s2 := PVOID_TO_STRING( p2 );
The result on a 32-bit system:
s1 = '16#00000000'
s2 = ''16#87DE0255' (may vary)
Requirements
Development environment | Target system type | PLC libraries to be linked |
---|---|---|
TwinCAT v2.11.0 Build >=2248 | PC or CX (x86, ARM) | TcUtilities.Lib ( Standard.Lib; TcBase.Lib; TcSystem.Lib are included automatically ) |