UCHAR CharToHex(char* ch)
{
	char Temp[2] = { 0 };
	for (int i = 0; i < 2; i++)
	{
		if (ch[i] >= '0' && ch[i] <= '9')
		{
			Temp[i] = (ch[i] - '0');
		}
		else if (ch[i] >= 'a' && ch[i] <= 'f')
		{
			Temp[i] = (ch[i] - 'a');
		}
		else if (ch[i] >= 'A' && ch[i] <= 'F')
		{
			Temp[i] = (ch[i] - 'A');
		}
	}
	return (Temp[0] << 4 & 0xf0) | (Temp[1] & 0xf);
}

 

posted on 2024-06-24 19:23  两线平行  阅读(4)  评论(0编辑  收藏  举报