StrToChar(CString str, UCHAR *dat)
{
UCHAR count;
for(count = 0; count < str.GetLength(); count++)
{
if(str[count] >= '0' && str[count] <= '9')
{
if(count % 2)
{
*dat += str[count] - '0';
dat++;
}
else
{
*dat = (str[count] - '0') * 0x10;
}
}
else if(str[count] >= 'A' && str[count] <= 'F')
{
if(count % 2)
{
*dat += str[count] - 'A' + 10;
dat++;
}
else
{
*dat = (str[count] - 'A' + 10) * 0x10;
}
}
else
{
return FALSE;
}
}
return TRUE;
}
CharToStr(UCHAR *dat, USHORT len)
{
CString temp;
UCHAR buffer[10];
CString str;
str = "";
while(len--)
{
temp = itoa(*dat, (char *)buffer, 16);
if(temp.GetLength() == 1)
{
temp = _T("0") + temp;
}
str += temp;
dat++;
}
str.MakeUpper();
return str;
}