BuffToHex

(System Library)

Description: Given a text buffer, this function will treat the content as an arbitrary sequence of bytes and convert it to a readable text buffer containing the sequence of hex numbers representing the bytes in the text buffer.
Returns: Text
Usage: Script Only.
Function Groups: String and Buffer
Related to: HexToBuff | MakeBuff
Format: System.BuffToHex(BinaryBuffer)
Parameters:  
BinaryBuffer
Required. The buffer that is to be converted to a hexadecimal string.

Comments

VTScada uses UTF-8 encoding for text. Bytes with values from 0 to 127 are valid characters. If a byte larger than 127 appears in a valid UTF-8 string, then it is only part of a multi-byte character and must be preceded by or followed by (or both), certain other bytes in a particular pattern or else it will be flagged as an invalid character

Examples:

    System.BuffToHex("ABCD");

…will return "41424344"

    System.BuffToHex(10);

…will return "3031". 10 is interpreted as the string "10", not the numeric, decimal value.

    System.BuffToHex(Concat(MakeBuff(1, 0xFF),
                      MakeBuff(1, 0x00),
                      MakeBuff(1, 0xAA)));

…will return "FF00AA"

    MachineIDString = System.BuffToHex(WkStaInfo(3));

…will return a hexadecimal representation of the workstation's unique identifier.