I use XOJO 2019r3 for a Windows 10 desktop programma.
When I use code :
eventData = New MemoryBlock(length)
eventData = pointer.Ptr(0)
eventDataString = ""
For nr As Integer = 0 to length -1
eventDataString = eventDataString + str(eventData.UInt8Value(nr), "000") + " "
Next
This works fine and the result is ‘255 033 001 000’
The values are correct and the formatting (“000”) works fine.
Following code :
eventData = New MemoryBlock(length)
eventData = pointer.Ptr(0)
eventDataString = ""
For nr As Integer = 0 to length -1
eventDataString = eventDataString + str(eventData.UInt8Value(nr).ToHex) + " "
Next
This works fine too, and the result is ‘FF 21 1 0’
The values are correct (no formatting)
In the following code the problem arises in the result.
I tried to format the hex value with “00” but this didn’t work correctly
eventData = New MemoryBlock(length)
eventData = pointer.Ptr(0)
eventDataString = ""
For nr As Integer = 0 to length -1
eventDataString = eventDataString + str(eventData.UInt8Value(nr).ToHex, "00") + " "
Next
The result is ‘00 21 01 00’.
Apparently the FF is replaced by 00 ?
I would like to have as result ‘FF 21 01 00’.
What am I doing wrong in the third code ?
Regards
Etienne