16进制数逆序输出

 	输入:D6FF1E64 	
	输出:641EFFD6 	

代码示例:
	char tempString[25];
	long  temp = -687923612;


	long hex1 = ( temp & 0xFF000000)>>24;          
	long hex2 = ( temp & 0x000000FF)<<24;
	long hex3 = ( temp & 0x00FF0000)>>8;
	long hex4 = ( temp & 0x0000FF00)<<8;
	long hexSum = hex1 + hex2 + hex3 + hex4;

	/*  
	//这种做法不行。 因为temp是局部变量

	long hex = ( temp & 0x000000FF)<<24 +
		  (temp & 0xFF000000)>>24 +
		  (temp & 0x00FF0000)>>8 +
		  (temp & 0x0000FF00)<<8;
	*/	
	sprintf(tempString,"%X",hexSum);

你可能感兴趣的:(windows)