# Thread: please can someone help me convert this

1. ## please can someone help me convert this

this is a vb function

VB Code:
```Public Function DeHexGkpr(Data As String) As String
Dim iCount As Integer, Temp As String
For iCount = 1 To 33 Step 2
Temp = Mid\$(Data, iCount, 2)
If Temp = "0A" Then
DeHexGkpr = DeHexGkpr & "\n"
ElseIf Temp = "20" Then
DeHexGkpr = DeHexGkpr & "\b"
ElseIf Temp = "0D" Then
DeHexGkpr = DeHexGkpr & "\r"
ElseIf Temp = "2C" Then
DeHexGkpr = DeHexGkpr & "\c"
ElseIf Temp = "5C" Then
DeHexGkpr = DeHexGkpr & "\\"
ElseIf Temp = "00" Then
DeHexGkpr = DeHexGkpr & "\0"
ElseIf Temp = "07" Then
DeHexGkpr = DeHexGkpr & "\t"
Else
DeHexGkpr = DeHexGkpr & Chr\$(Val("&H" & Temp))
End If
Next iCount
End Function```

the parameter fed into DeHexGkpr is a random 32 character hexstring
0-9, A-F

Please can someone help me convert this into a c++ function?
it takes every 2 characters at a time and turns it into their coressponding escape character

2. ## Re: please can someone help me convert this

Find a VB to C++ converter on the web.

3. ## Re: please can someone help me convert this

ok thanks, do you know of any free converters?

4. ## Re: please can someone help me convert this

Not off hand.

5. ## Re: please can someone help me convert this

ok thanks but can someone tell me what this part does:

Chr\$(Val("&H" & Temp))

whats the &H and Val, e.g &H07

im gona try and give it a go myself

6. ## Re: please can someone help me convert this

That is the vb way of converting a hexadecimal string to a number and that number to a character. In C++ you would do:
Code:
```std::string temp = "8c"; // some hex string
char c = atio(temp.c_str());```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Click Here to Expand Forum to Full Width