Bytes2HexStr与hexStr2Bytes

/*   Byte值转换为bytes字符串 
*   @param src:Byte指针 srcLen:src长度 des:转换得到的bytes字符串   
**/  
static void Bytes2HexStr(BYTE *src,int srcLen,BYTE *des)
{
	BYTE *res;
	int i=0;

	res = des;
	while(srcLen>0)
	{
		sprintf((char*)(res+i*2),"%02x",*(src+i));
		i++;
		srcLen--;
	}
}

/**  
 * bytes字符串转换为Byte值   
* @param String src Byte字符串,每个Byte之间没有分隔符   
* @return byte[]   
*/   
static BYTE* hexStr2Bytes(string src)
{
	char *strEnd;
	int m=0;
	int len = src.length()/2;
	BYTE* ret = new BYTE[len];

	for(int i =0;i

你可能感兴趣的:(C++)