Archive: Str2Hex


Str2Hex
Hi,

I try you write a function that
- convert each character to decimal ascii code
- convert decimal ascii code to hex code
- concatenate hex codes to string without 0x

I can't get the '65' of 0x65.

StrCpy $0 ""
IntFmt $1 "0x%02X" 0x65
StrCpy $2 $1 -2
MessageBox MB_OK "$1 $2"
StrCpy $0 "$0$2"

StrCpy $0 ""
IntFmt $1 "0x%02X" 0x66
StrCpy $2 $1 2
MessageBox MB_OK "$1 $2"
StrCpy $0 "$0$2"

MessageBox MB_OK "expect 6566: $0 get 0x"

Is '0x65' a string that can be manipulate with StrCpy?
How can I cut off the '0x'

- minutes later -

I will use this
IntFmt $1 "%02X" 0x66

But what happend in the above code?

thx.


Re: Str2Hex

Originally posted by nechai
Is '0x65' a string that can be manipulate with StrCpy?
How can I cut off the '0x'
StrCpy $0 "a string" # = "a string"
StrCpy $0 "a string" 3 # = "a s"
StrCpy $0 "a string" -1 # = "a strin"
StrCpy $0 "a string" "" 2 # = "string"
StrCpy $0 "a string" "" -3 # = "ing"
StrCpy $0 "a string" 3 -4 # = "rin"