BCB里如何将字节数组转换为十六进制字符串?求大虾指点
public static string AdressByteArrayToHexString(byte[] address)
{
int length = address.Length * 2;
string result = "";
for(int i = address.Length -1 ; i >= 0 ; i--)
{
string temp = Convert.ToString(address[i], 16).PadLeft(2, '0');
result += temp;
}
return result.ToUpper();
}
这是C#里的代码 不知道在BCB里如何实现,求大虾支招啊 ~~不甚感激
[解决办法]
String AdressByteArrayToHexString(byte * address){ int length = sizeof(address) ; String result = ""; for(int i = length -1 ; i >= 0 ; i--) { String temp; temp.sprintf("%02X", address[i]); result += temp; } return result.UpperCase();}