Home > Archive > Clarion > October 2006 > How can i display a Hex string from a TCP connection.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How can i display a Hex string from a TCP connection.
|
|
| allan@ransoft.dk 2006-09-30, 6:55 pm |
| Hi,
Do any have a peace of code that make a hex string possible to display
right.
If I get a string <01h><05h><64h> Then i want just to display it as 010564
with out any conversion.
Any idea's.
| |
| Robert Peros 2006-10-02, 3:55 am |
| <allan@ransoft.dk> wrote in message
> Do any have a peace of code that make a hex string possible to display
> right.
> If I get a string <01h><05h><64h> Then i want just to display it as 010564
> with out any conversion.
Variation of similar code.
hex string STRING()
Displ BYTE,DIM(1),OVER(hex string)
Form_Str STRING()
LOOP idx_# = 1 TO LEN(hex string)
Form_Str = CLIP(Form_Str) & FORMAT(Displ[idx_#],@N02)
END
R.
| |
| Robert Peros 2006-10-03, 3:55 am |
| > <allan@ransoft.dk> wrote in message
> Variation of similar code.
> hex string STRING()
> Displ BYTE,DIM(1),OVER(hex string)
> Form_Str STRING()
Hex STRING('0123456789ABCDEF')
Previous case is for decimal value,but you need dec byte/string 2 hex-a.
and this can be used with VAL() so no need byte conversion at all.
> LOOP idx_# = 1 TO LEN(hex string)
Form_Str = CLIP(Form_Str) !or w/o CLIP-> Cstring |
& Hex[BAND(BSHIFT(VAL(hex_string[idx_#]), - 4),0Fh) + 1] |
& Hex[BAND(VAL(hex_string[idx_#]),0Fh) + 1]
> END
R.
|
|
|
|
|