Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - convert hex value to string
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

convert hex value to string

 Post Reply Post Reply
Author
Message
manoj View Drop Down
Newbie
Newbie
Avatar

Joined: 26 October 2004
Location: India
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote manoj Quote  Post ReplyReply Direct Link To This Post Topic: convert hex value to string
    Posted: 14 April 2005 at 5:33am

hi

please tell me how can i convert hex value to normal charactor string programatically

e.g.
44,00,3a,00,5c,00,44,00,6f,00,63,00,75,00,6d,00,65,00,6e,00, 74,00,73,00,20,00,61,00,6e,00,64,00,20,00,53,00,65,00,74,00, 74,00,69,00,6e,00,67,00,73,00,5c,00,41,00,6d,00,6f,00,6c,00, 2e,00,41,00,4d,00,4f,00,4c,00,5c,00,4c,00,6f,00,63,00,61,00, 6c,00,20,00,53,00,65,00,74,00,74,00,69,00,6e,00,67,00,73,00, 5c,00,41,00,70,00,70,00,6c,00,69,00,63,00,61,00,74,00,69,00, 6f,00,6e,00,20,00,44,00,61,00,74,00,61,00,5c,00,4d,00,69,00, 63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,5c,00,4f,00,75,00, 74,00,6c,00,6f,00,6f,00,6b,00,5c,00,4f,00,75,00,74,00,6c,00, 6f,00,6f,00,6b,00,2e,00,70,00,73,00,74,00,00,00

want to convert in normal string pls send me pcs of code

 

Thanking you

 

Manoj Jangid

Back to Top
gshawn View Drop Down
Senior Member
Senior Member


Joined: 04 October 2004
Status: Offline
Points: 227
Post Options Post Options   Thanks (0) Thanks(0)   Quote gshawn Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2005 at 5:55am

What language? Here is some VB code off the top of my head:

Dim strArray As String
Dim strLetters() As String
Dim strTranlation As String

strArray = "44,00,3a,00,5c,00,44,00,6f,00,63,00,75,00,6d,00,65,00,6e,00"

strLetters = Split(strArray, ",")

For i=lBound(strLetters) To uBound(strLetters)
    strTranslation = strTranslation & Chr(Val("&H" & strLetters(i)))
Next

MsgBox strTranslation

Looking at your string, it looks like it's UNICODE since every other byte is 00 so you'll probably want to handle that too... a simple Replace(1, strArray, ",00", "") might do the trick if you have no way to change the format of the hex character string.

Hope this helps!

Back to Top
manoj View Drop Down
Newbie
Newbie
Avatar

Joined: 26 October 2004
Location: India
Status: Offline
Points: 31
Post Options Post Options   Thanks (0) Thanks(0)   Quote manoj Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2005 at 6:33am

I need a c++ code and in above code spaces is trucated if i use replace method.

 

Thanking you

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.201 seconds.