Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 15543, Convert Hex to Ascii

by Sammy Hale Email: Anonymous


This code will help you to unpack hex code and convert it to ascii
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 1.0  to 5.0 1398 downloads
Copyright: No significant restrictions


Size: 323 bytes
Updated on Sun, 28 Jan 2001 15:05:13 GMT
Originally uploaded on Sun, 28 Jan 2001 15:01:17 GMT
SHA1 Hash: 1FB5399FDD67C660E383DF72A94E2E9B62A22446
MD5 Hash: A5143B50B339149DD2341E0EC30B8E74

    Explore the files in this upload

Description
The following code will convert Hex to ASCII:

unpack(char *str, int len)
{
int x;
int y = 0;
int t;
unsigned char tmp[200];

memcpy(tmp, str, len);
t = 0;
y = 0;
for (x=0; x t = ((unsigned char)tmp[x] & 0xf0);
t = t >> 4;
t = t & 0x0f;
sprintf([y++], "%X", t);
t = ((unsigned char)tmp[x] & 0x0f);
sprintf([y++], "%X", t);
}
str[y] = 0;//this is the ascii conversion
return(t);// this is the hex to decimal conversion
}

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Server Response from: ETNACDC03